3 ms·
More and more websites are so advanced that they can’t even use an <a> tag anymore. Instead they do some convoluted onclick-scripting that breaks all standard b
by simongr3dal 7y ago
More and more websites are so advanced that they can’t even use an <a> tag anymore. Instead they do some convoluted onclick-scripting that breaks all standard behavior and accessibility functionality.
- notyourwork 7y agoI think complicated is a better choice than advanced. Intentionally complicated without adding value in a lot of cases.
- wccrawford 7y agoI'm sure "advanced" was sarcasm.
- ronsor 7y agoShould have italicized advanced (or put it in quotes)
- gempir 7y agoI think this is mostly a problem of the tools used. An anchor tag by definition is an inline element, so it shouldn't really be a giant box that's clickable, so you default back to an onClick. onClick in popular frameworks just means left click and nothing more, which makes sense, except for that use case of opening in a new tab with middle mouse button or right clicking etc. So you have to add a lot of logic to support all that. If you break the html spec and make an anchor tag a block element then you have to deal with catching and stopping the event from it otherwise it would work as a normal link but you actually just want to change state in your JS app. So I think tools like Angular, React, Vue etc. should get a better way to create links on website that just change state .
- eitland 7y ago> So you have to add a lot of logic to support all that. Or, to point out the thing that is obvious to anyone who grew up on the old web: Removing a whole lot of logic also works.
- mcbits 7y agoStyling an anchor as a block element has never violated the spec, and HTML5 deliberately added support for wrapping anchors around block elements because people had been doing that anyway, even though the browser wasn't required to make it work as intended (but it now is).