3 ms·
> Hard disagree on the first point. > Anchors are perfectly fine for jumping to a specific point on a page. Nearly all documentation websites do it, wikipedia
by reificator 6y ago
> Hard disagree on the first point.
> Anchors are perfectly fine for jumping to a specific point on a page. Nearly all documentation websites do it, wikipedia does it, etc...
I don't think that point says to not use anchors for in-page navigation.
They're not objecting to `href="#my_anchor"`, they're objecting to `href="#" onclick="doStuff()"`, which is increasingly common on the web today.
- asddubs 6y agoincidentally if you must do this, it's better to use href="javascript:;" rather than href="#" because it won't cause jumps in position for noscript users/when scripts break
- 7786655 6y agohref="javascript:;" is also bad. It doesn't work if you try to open it in a new tab. Just use a real url!
- reificator 6y agoThere isn't a situation where you must do this. Don't do this. Quick heuristic: if you have a clickable link and I can't open it in a new tab, you should be using a button instead.
- paul_f 6y agohref="javascript:..." is just as bad. I want to hover over a link and see where it goes before I click. That makes navigation fair to the user, as opposed to "guess what's behind door number 3"