Re:The right tag for the job: why you should use semantic HTML
by jeroenhd on Sunday June 06, 2021 @03:07PM
(#27415448)
I've run into some bugs because of composition, something about <a> tags nesting breaking everything, but only in release mode (minified etc.). Not fun to hunt down. I don't remember the details, but I've also seen warnings about other semantic stuff that's enforced (it at least complained about) by the framework.
Technically you could make everything a div or a text element, but most frameworks you use come with certain expectations: the closer you are to using semantic tags, the less likely you'll be to violate those external expectations.
If you're not using any frameworks, I don't see why you wouldn't use semantic tags by default. Sure, you can override the onclick if an anchor with no href and call preventDefault, but why not just use a button instead?
Technically you could make everything a div or a text element, but most frameworks you use come with certain expectations: the closer you are to using semantic tags, the less likely you'll be to violate those external expectations.
If you're not using any frameworks, I don't see why you wouldn't use semantic tags by default. Sure, you can override the onclick if an anchor with no href and call preventDefault, but why not just use a button instead?