Skip to content
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

Scroll to search result after navigation #17

Open
ricardoboss opened this issue Jul 27, 2022 · 5 comments
Open

Scroll to search result after navigation #17

ricardoboss opened this issue Jul 27, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@ricardoboss
Copy link
Member

Currently, when clicking on a search result, it just takes the user to the page itself, not the part where the search term is located.

As I see it currently, we have two options to improve the users experience:

  • Find the nearest parent heading and modify the anchor of the search result URL to jump to this heading
  • Use the new 'scroll-to-text-fragment' feature some browsers already implement (stackoverflow question, caniuse, docs, spec)

The second option is only supported in chromium-based browsers.

@ricardoboss ricardoboss added the enhancement New feature or request label Jul 27, 2022
@chucker
Copy link

chucker commented Jul 27, 2022

Seems like it'll be a while until WebKit supports it, so we should probably go with the first for now?

@ricardoboss
Copy link
Member Author

What about a feature switch based on the detected browser? Implement both and choose at runtime?

@chucker
Copy link

chucker commented Jul 27, 2022

We can do that, but you'd have to hardcode user agents. (FWIW, Mozilla doesn't seem to be sure yet if a competing spec is better: https://mozilla.github.io/standards-positions/#fragmention)

@ricardoboss
Copy link
Member Author

Yeah ok, might better to stick to the standards on this one. So nearest parent heading it is?

@chucker
Copy link

chucker commented Jul 27, 2022

Yeah, IMHO, just go with nearest for now and reëvaluate in a year or so.

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

When branches are created from issues, their pull requests are automatically linked.

2 participants