trenz-gmbh / trenz-docs

An SPA wiki made by TRENZ
MIT License
3 stars 0 forks source link

Scroll to search result after navigation #17

Open ricardoboss opened 2 years ago

ricardoboss commented 2 years ago

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:

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

chucker commented 2 years ago

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

ricardoboss commented 2 years ago

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

chucker commented 2 years ago

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 commented 2 years ago

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

chucker commented 2 years ago

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