Remix.run Logo
jer0me 4 days ago

Another solution I quite like is highlighting the headings of all the sections that are currently on screen.

technojamin 4 days ago | parent | next [-]

This seems like the obvious solution to me. You don't know what the user's eyes are looking at, so making the highlighting a visual representation of what's in the viewport seems preferable than nominating a single section as "current".

In fact the final solution is pretty bad. Sure, it looks nice when I scroll down, but when I use the alternative navigation method of clicking the sidebar items, it just scrolls to unexpected places.

Beautiful article, though.

codazoda 4 days ago | parent | prev [-]

I agree…

I don’t think this is a real problem that needs solving; or I at least think it’s a problem browser vendors should solve, but lets over engineer it while still trying to keep it simple and usable…

What I might do is something similar to what you’re suggesting. I would have the anchor tag be a regular old anchor tag. Then, I’d highlight the heading (maybe just temporarily) at the same time. I’d use CSS if I could figure that out or JS if I couldn’t. The end result would send the user to the normal place and flash a highlight on the heading for users with JS support.

Keep it simple, but over engineer it to make whoever requested this happy.

Edit: After re-reading your response we probably aren’t talking about the same thing, exactly.