Skip to content

Highlight linked issue comment - #1165

Merged
fregante merged 3 commits into
refined-github:masterfrom
salmanulfarzy:highlight-linked-comment
Mar 13, 2018
Merged

fregante merged 3 commits into
refined-github:masterfrom
salmanulfarzy:highlight-linked-comment

Conversation

@salmanulfarzy

@salmanulfarzy salmanulfarzy commented Mar 12, 2018 •

Copy link
Copy Markdown
Contributor

Highlight linked issue comments with :target and modified color. Hope this is what you expected @bfred-it.

Test comment : #988 (comment)
highlight linked issue

Close #1164

@hkdobrev
hkdobrev requested a review from fregante March 12, 2018 08:20
@salmanulfarzy

Copy link
Copy Markdown
Contributor Author

Not sure whether related, But reaction avatars of linked comments are back to default GitHub style 😕

Test comment: #1122 (comment)

highlight linked issue regression

@fregante

fregante commented Mar 12, 2018 •

Copy link
Copy Markdown
Member

It should probably include all the rules from GitHub, to make sure it works in every case. We can just pick the coloring properties and drop the rest. Their code is:

.timeline-comment-wrapper .timeline-comment.unread-item::after,
.timeline-comment-wrapper .timeline-comment.unread-item::before {
    position: absolute;
    top: 11px;
    right: 100%;
    left: -16px;
    display: block;
    width: 0;
    height: 0;
    pointer-events: none;
    content: " ";
    border-color: transparent;
    border-style: solid solid outset
}

.timeline-comment-wrapper .timeline-comment.unread-item::after {
    margin-top: 1px;
    margin-left: 2px;
    border-width: 7px;
    border-right-color: #fffdef
}

.timeline-comment-wrapper .timeline-comment.unread-item::before {
    border-width: 8px;
    border-right-color: #e5d999
}
.timeline-comment.unread-item {
    border-color: #e5d999
}

.timeline-comment.unread-item .timeline-comment-header {
    background-color: #fffdef;
    border-bottom-color: #e5d999
}

.timeline-comment.unread-item .timeline-comment-label {
    border-color: #e5d999
}

.timeline-comment.unread-item .previewable-comment-form .comment-form-head.tabnav {
    color: #e5d999;
    background-color: #fffdef;
    border-bottom-color: #e5d999
}

This is how linking my own comments look like:

own comment

And this is what it should look like (screenshot made with .unread-item)

own comment, correct colors

@fregante fregante left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⬆️

@hkdobrev

Copy link
Copy Markdown
Contributor

@bfred-it Wouldn't using JS enable the functionality from GitHub where the custom styling disappears after a bit?

@fregante

fregante commented Mar 12, 2018 •

Copy link
Copy Markdown
Member

I don't see why that would be desirable; the comment should be colored as long as the :target points to it, like the rest of the site (e.g. permalinked code)

Perhaps using the JS is not a big deal, it'd just be something like:

select(':target').classList.add('unread-item');
onhashchange -> repeat

But I’d rather have it all be handled by some copy-pasted CSS than dealing with logic, ajax, etc

@salmanulfarzy

salmanulfarzy commented Mar 13, 2018 •

Copy link
Copy Markdown
Contributor Author

Updated with suggested modifications. But few questions about it,

  • Should we modify the color of border around reactions ?
  • Can't find a selector to change color for ::before with .current-user. Current selector affects all the comments by user on thread.

highlight issue comment before error

Highlighted labels

highlight comment user label

@fregante

fregante commented Mar 13, 2018 •

Copy link
Copy Markdown
Member

Should we modify the color of border around reactions ?

Sure, your screenshot looks good on that.

Can't find a selector to change color for ::before with .current-user.

You don't need a specific one for .current-user, if you add :root at the beginning of your selector it will make it strong enough to cover them all.

I posted the whole code, there's a couple ::before/::after selectors there that I don't see in your commits. All those rules need to be in there or else we're just playing whack-a-mole.

@salmanulfarzy

salmanulfarzy commented Mar 13, 2018 •

Copy link
Copy Markdown
Contributor Author

I'm extremely sorry for overlooking ::after, Will make the necessary modifications.

Edit: Done.

highlight current user

@fregante

fregante commented Mar 13, 2018 •

Copy link
Copy Markdown
Member

Each selector needs :root at the start otherwise it's not strong enough to override the .current-user style.

- .timeline-comment:target {
+ :root .timeline-comment:target {

d

@fregante

Copy link
Copy Markdown
Member

Screenshot for readme

@fregante
fregante merged commit 81b108a into refined-github:master Mar 13, 2018
@fregante

Copy link
Copy Markdown
Member

Thanks for your PR, @salmanulfarzy!

By the way this is particularly useful when opening notifications because now the least recent unread comment will be highlighted (because the notifications link to it)

@salmanulfarzy
salmanulfarzy deleted the highlight-linked-comment branch March 13, 2018 15:18
@yakov116

Copy link
Copy Markdown
Member

@salmanulfarzy thank you so much! this has been a real help for me!

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

Development

Successfully merging this pull request may close these issues.

4 participants