Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JuanitoFatas
Copy link
Member

@JuanitoFatas JuanitoFatas commented May 7, 2025

It feels a bit awkward with the scroll bar on the left 😅 E.g. Process#kill. This PR removes the visual highlight for anchored method links.

Before After
CleanShot 2025-05-07 at 23 38 43@2x CleanShot 2025-05-07 at 23 38 17@2x

@@ -581,7 +581,6 @@ main .method-detail {

main .method-detail:target {
margin-left: -10px;
border-left: 10px solid var(--border-color);
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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.
heading_borderleft_style

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 {

Since the anchor link always brings people to the top of the page. I think it’s
okay to remove both border-left and margin-left which was acting as highlight here.

The method name should be easy to spot without extra highlighting.
@JuanitoFatas JuanitoFatas force-pushed the remove-border-left-from-method-details branch from 1033728 to e6fd1f8 Compare May 7, 2025 14:36
@JuanitoFatas JuanitoFatas changed the title Remove border-left from method details Remove visual highlight for anchored method links May 7, 2025
@p8
Copy link
Contributor

p8 commented May 12, 2025

In SDoc we show a small highlight next to the method as well:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants