-
Notifications
You must be signed in to change notification settings - Fork 441
Remove visual highlight for anchored method links #1363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Remove visual highlight for anchored method links #1363
Conversation
@@ -581,7 +581,6 @@ main .method-detail { | |||
|
|||
main .method-detail:target { | |||
margin-left: -10px; | |||
border-left: 10px solid var(--border-color); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value margin-left: -10px
should be "-#{border_left_width}px"
. If border-left is 0
, margin-left should also be 0
.
However, this border-left is a highlight of the focused method. Could you suggest a better highlight instead of completely removing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense now. Given that the anchor link reliably brings the method to the top of the viewport, I think we could remove both border-left
and margin-left
.
The method name is easy to spot without extra highlighting. It will look like this if we remove both the border and margin:
CleanShot.2025-05-07.at.23.29.28.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of the features of RDoc. I don't want to remove it as possible if it is fixable.
This border-left exists in other links to heading tags, not only to method links.
Differences are:
Border-left to method links are applied to the whole div.method-detail
content while border-left to other links are only applied to heading tags.
How about changing the border-left target to heading of the method detail?
It will be more consistent between method links and other links to heading tags.
- main .method-detail:target {
+ main .method-detail:target .method-heading {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this! Pushed up 212b284 and updated the screenshot in PR body.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you leave the margin-left and border style as is?
There is a layout shift. On the other hand, h2:target
and the original .method-detail:target
doesn't have this layout shift.
Of course we can discuss adding a padding to h2:target
and/or .method-detail:target .method-heading
, with or without this layout shift.
But it's easy to merge if the point of this pull request is clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. Sorry for all the back and forth. Updated.
1033728
to
e6fd1f8
Compare
e6fd1f8
to
212b284
Compare
212b284
to
8c02435
Compare
It feels a bit awkward with the scroll bar on the left 😅 E.g. Process#kill. This PR changes the visual highlight to only apply on the heading for anchored method links.