←back to thread

Overengineered Anchor Links

(thirty-five.com)
392 points matser | 3 comments | | HN request time: 0.433s | source
1. jer0me ◴[] No.43572494[source]
Another solution I quite like is highlighting the headings of all the sections that are currently on screen.
replies(2): >>43573070 #>>43573235 #
2. codazoda ◴[] No.43573070[source]
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.

3. technojamin ◴[] No.43573235[source]
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.