Skip to content

Do not remove diff signs from DOM unless GitHub feature is not supported - #1451

Merged
sindresorhus merged 2 commits into
refined-github:masterfrom
KattMingMing:issue-1444
Jul 30, 2018
Merged

sindresorhus merged 2 commits into
refined-github:masterfrom
KattMingMing:issue-1444

Conversation

@KattMingMing

@KattMingMing KattMingMing commented Jul 29, 2018 •

Copy link
Copy Markdown
Contributor

This resolves #1444 so that diffs on GitHub.com are only modified if the new GitHub diff sign selection feature is not supported. This means legacy versions of GitHub will continue to support the feature via Refined GitHub and newer GitHub DOMs will use the built in support provided by GitHub.com.

This ensures that users of both GitHub.com and GitHub Enterprise (older versions) can use Refined GitHub without disabling the remove-diff-sign feature.

Also this will ensure that if GitHub reverted the change Refined GitHub will continue to work as expected.

@KattMingMing KattMingMing changed the title fix (#1444): do not remove diff signs from DOM unless GitHub Enterprise fix (#1444): do not remove diff signs from DOM unless GitHub feature not supported Jul 29, 2018
… default, but continue to support for GHE deployments"
@yakov116

Copy link
Copy Markdown
Member

@sindresorhus @bfred-it ?

@sindresorhus sindresorhus changed the title fix (#1444): do not remove diff signs from DOM unless GitHub feature not supported Do not remove diff signs from DOM unless GitHub feature is not supported Jul 30, 2018
@sindresorhus
sindresorhus merged commit d773874 into refined-github:master Jul 30, 2018
@sindresorhus

Copy link
Copy Markdown
Member

Thanks, @KattMingMing :)

@yakov116

Copy link
Copy Markdown
Member

@sindresorhus can you do a hotfix?

@sindresorhus

Copy link
Copy Markdown
Member

Done. New version is out now.

@KattMingMing
KattMingMing deleted the issue-1444 branch July 30, 2018 17:59
@krlmlr

krlmlr commented Jul 30, 2018

Copy link
Copy Markdown

Just got the update from Mozilla's repos. Works as advertised, thank you very much!

@jerone

jerone commented Jul 31, 2018

Copy link
Copy Markdown
Contributor

So, this PR will disable the 'remove diff signs` feature for newer versions of GitHub, but it does not fix it. What about adding the following to actually make it work again...

.blob-code-marker-addition:before,
.blob-code-marker-context:before,
.blob-code-marker-deletion:before {
	display: none !important;
}

@KattMingMing

Copy link
Copy Markdown
Contributor Author

@jerone - GitHub implemented this feature so it's not necessary for Refined GitHub to provide that behavior on GitHub versions that already implement this as the default selection.

Are you able to select the diff signs when highlighting code in a diff?

@jerone

jerone commented Jul 31, 2018

Copy link
Copy Markdown
Contributor

@KattMingMing I thought the intention of remove-diff-signs.js is to remove diff signs. The signs are redundant in combination with the colors.

@KattMingMing

Copy link
Copy Markdown
Contributor Author

@KattMingMing I thought the intention of remove-diff-signs.js is to remove diff signs. The signs are redundant in combination with the colors.

According to the feature spec, the intended behavior was to make the + and - signs in diffs unselectable for easier copy-pasting.

@jerone - I agree that it is redundant, but it might be there for accessibility reasons. I'm not sure. Do you want to open a feature request to remove the + and - signs entirely?

@waldyrious

Copy link
Copy Markdown
Contributor

Perhaps a better name would make its purpose unambiguous. remove-diff-signs.js --> make-diff-signs-unselectable.js?

@busches

busches commented Aug 1, 2018

Copy link
Copy Markdown
Member

@waldyrious submit a PR with the change, don't forget to add a migration step. :)

@waldyrious

Copy link
Copy Markdown
Contributor

submit a PR with the change

Sure!

don't forget to add a migration step. :)

Any pointers to what these should look like? I haven't contributed before.

@busches

busches commented Aug 2, 2018

Copy link
Copy Markdown
Member

@hkdobrev

hkdobrev commented Aug 2, 2018

Copy link
Copy Markdown
Contributor

Here's the announcement blog post: https://blog.github.com/changelog/2018-07-31-unselectable-diff-markers/

I guess it has been rolled out to everyone now.

@jerone

jerone commented Aug 2, 2018

Copy link
Copy Markdown
Contributor

@KattMingMing commented on Jul 31, 2018, 11:30 PM GMT+2:

According to the feature spec, the intended behavior was to make the + and - signs in diffs unselectable for easier copy-pasting.

@jerone - I agree that it is redundant, but it might be there for accessibility reasons. I'm not sure. Do you want to open a feature request to remove the + and - signs entirely?

Created a feature request: #1464

@waldyrious

Copy link
Copy Markdown
Contributor

Looking at the actual code, it looks like it doesn't really make the diff signs unselectable -- it seems to be removing the signs from the clipboard buffer or equivalent construct. I'm going by the code here: https://github.com/sindresorhus/refined-github/blob/ba34c09eaac05d54d5ff837edd4fbf504378a9a3/source/features/remove-diff-signs.js#L17-L18

If my interpretation is correct, then the renaming I suggested above would not make sense; at most, it could be something like remove-diff-signs.js --> remove-diff-signs-from-copy-buffer.js, but that is probably overkill. Thoughts?

@jerone

jerone commented Aug 3, 2018

Copy link
Copy Markdown
Contributor

not-copy-diff-signs.js maybe?

@waldyrious

Copy link
Copy Markdown
Contributor

not-copy-diff-signs.js maybe?

Sounds good to me, although I'd personally favor something closer to prevent-copy-of-diff-signs.js, to make this an active/action sentence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Github now excludes + and - when copying from diffs

8 participants