top | item 36378015

(no title)

vivegi | 2 years ago

Name Anchors has been a thing in HTML for a very long time (at least since HTML 2.0 spec [1], if not earlier).

  <a name="myanchor"><h3>Things to do</h3></a>
If the CMS supports name anchors, you can just bookmark it as

  https://example.com/foo.html#myanchor
Of course, authors are not mandated to follow named anchors for their document fragments, so this is just a best practice.

[1]: https://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.4

discuss

order

cookiengineer|2 years ago

Post JS build pipelines and web packers, most element names and classes are just minified garbage.

Sadly most web devs don't give a damn about accessibility anymore :(

Especially not in the React and Angular based ecosystems and toolchains. Server-side rendering was popular for a while, but even then the generated HTML codes were pretty useless for A11y focussed products.

austin-cheney|2 years ago

You don’t need named anchors to accomplish the goal of URL fragments. ID attribute values on any element accomplish the same goal.

vivegi|2 years ago

Yes. The name/id choice recommendation has been evolving since the original HTML spec. For modern browsers (in 2023), you are right about the id attribute. Some very old browsers needed the name anchors.