Repository navigation
remove diff signs - #254
jacobbearden wants to merge 1 commit into
Conversation
|
👍 - This should make copy-pasting from diffs easier as well. |
|
LGTM I'd like to see if another collaborator would like the idea though. |
|
I like this a lot. Should probably wait for @sindresorhus to 👍 though. |
|
Nice!! |
I agree on both counts. Though it's pretty benign and we all seem to like it. 😄 |
|
👍 I actually have a todo item to open an issue about this here. Or rather my idea was to strip the |
|
Can you add a note about it in the readme highlights? Regarding being able to copy-paste from diffs now. |
|
FWIW, relying upon red vs green (or even colors at all, but particularly this) is bad for accessibility. Ideally they would be subtle and non-copyable exactly like the line numbers. |
This is a fair point, sure. I don't know if this addresses accessibility entirely (I know it won't help screenreaders), but we could attach a This is working for me locally (you could do the fonts in the td.blob-code.blob-code-addition:before,
td.blob-code.blob-code-deletion:before {
display: inline-block;
font-family: 'Ubuntu Mono', 'Droid Sans Mono', 'Operator Mono', 'Liberation Mono', 'Source Code Pro', Menlo, Consolas, Courier, monospace !important;
}
td.blob-code.blob-code-addition:before {
content: '+';
}
td.blob-code.blob-code-deletion:before {
content: '-';
}Thoughts? It undoes @jacobbearden's design choice for accessibility. Edits: Trying to clarify that the pseudo-elements are visible but won't be copied. |
|
@jacobbearden thanks for the new commit, I was going to make that comment but you fixed it before I could. 🏇 |
|
@paulmolluzzo I took your idea a bit further with: td.blob-code.blob-code-addition:before,
td.blob-code.blob-code-deletion:before {
display: inline-block;
font-family: 'Ubuntu Mono', 'Droid Sans Mono', 'Operator Mono', 'Liberation Mono', 'Source Code Pro', Menlo, Consolas, Courier, monospace !important;
color: rgba(0,0,0,0.3);
-webkit-user-select: none;
}
td.blob-code.blob-code-addition:before {
content: '+';
}
td.blob-code.blob-code-deletion:before {
content: '-';
}Result: |
You don't really need Here's the spec, pseudo elements are not in the document tree: https://www.w3.org/TR/2011/REC-CSS2-20110607/generate.html |
|
TIL, I guess I read your comment wrong and thought the text was still selectable. |
|
My bad. The point of the pseudo is to make it only visible and not selectable. I tried to edit the other comment... I do like the reduced opacity though. That's a nice improvement. 👍 |
| td.blob-code.blob-code-addition:before, | ||
| td.blob-code.blob-code-deletion:before { | ||
| display: inline-block; | ||
| font-family: 'Ubuntu Mono', 'Droid Sans Mono', 'Operator Mono', 'Liberation Mono', 'Source Code Pro', Menlo, Consolas, Courier, monospace !important; |
There was a problem hiding this comment.
Could you please move this to custom.css where we have this font stack defined? Add these new selectors and a comment about what they're for. It'll make it easier if we ever update the font stack for monospace/code text.
|
I think without the Is accessibility a design goal of |
This is a good point. How likely is it that they're needed? |
I'm colorblind. Does that count? Add in flux or some crappy screen and it could be tough to see a diff at a glance. The offscreen thing is for screen reader accessibility and the pseudo elements won't get read regardless of their displayed position (AFAIK). Usually you do offscreen text alignment for logos/images you still want text for. Edit to add: I proposed a solution for meeting some accessibility requirements, but I'm not saying the solution must be implemented. I am fine with or without the extra symbols being included. |
Absolutely. It looks like the I think we should defer to whichever you think looks best. The Copy / Paste behavior is the more important feature anyways. |
|
Ok, let's go with what @paulmolluzzo suggested. |
|
@sindresorhus with or without the reduced opacity? |
|
That's up to @paulmolluzzo. |
|
Let's keep the reduced opacity @jacobbearden. It's still visible but not distracting. |
|
Alright, then this is ready to go as is! |
|
👍 I think we can go to master like this. Any last thoughts @sindresorhus? |
| - [Adds ability to collapse/expand files in a pull request diff](https://cloud.githubusercontent.com/assets/170270/13954167/40caa604-f072-11e5-89ba-3145217c4e28.png) | ||
| - [Adds links to patch and diff for each commit](https://cloud.githubusercontent.com/assets/737065/13605562/22faa79e-e516-11e5-80db-2da6aa7965ac.png) | ||
| - [Differentiates merge commits from regular commits](https://cloud.githubusercontent.com/assets/170270/14101222/2fe2c24a-f5bd-11e5-8b1f-4e589917d4c4.png) | ||
| - Makes it easier to copy/paste from diffs |
There was a problem hiding this comment.
Be more specific. Don't make users ask themselves: "How will it make it easier?"
detect PR files, add readme note readd as pseudo element style/sizing changes, reword readme change
| $('.blob-code-deletion .blob-code-inner, .blob-code-addition .blob-code-inner').each((index, element) => { | ||
| const textNode = element.childNodes[0]; | ||
|
|
||
| textNode.nodeValue = textNode.nodeValue.replace(/^[+-]/, ' '); |
|
ping :) |
|
Just for reference, here is an extension that strips characters on copy/paste: The implementation is definitely hacky. |
|
Closing for lack of response. @jacobbearden Happy to reopen if you ever get to this ;) |
|
This is a nice thing, why close it? How else can you get your removed codes without the dash in front? |
|
@anoop-ananthan This was implemented later in #282 |
|
@bfred-it Thanks for the reply. But I don't think this was implemented. Here is a sample of copied text. |
|
It was definitely implemented so if it doesn't work it's a bug. Can you open an issue with more information? e.g. a link |




I feel like the red and green backgrounds on diffs are explanatory enough, and the +/- just make things messier.
Before
After