Live data from Hacker News

You can make up HTML tags

maurycyz.com

161–170 of 202 posts

Re: You can make up HTML tags

#161

Earlier quoted context omitted.

Mainly because it isn't semantic and breaks accessibility features. If you find yourself writing layouts like this you're probably ignoring a bunch of useful stuff like etc. Unless you manually configure it yourself, screen readers won't know what's important to read, tabindex won't know where to jump around, and form fields won't know what values to offer.

> isn't semantic It's certainly better than calling everything a div. > breaks accessibility features I don't know if I'd call it breakage to just... not use them where they should be used. Of course if a real tag exists that adequately matches the author's intent, that should be preferred over a made-up one.

> It's certainly better than calling everything a div.

It's not. For semantic purposes is the same as . So on the surface they are equivalent.

But if you are in the habit of using custom elements then you will likely continue to use them even when a more useful element is available so rather than so in practice it is probably worse even if theoretically identical.

Basically divs with classes provide no semantic information but create a good pattern for using semantic elements when they fit. Using custom elements provides no semantic information and makes using semantic elements look different and unusual.

Re: You can make up HTML tags

#162

The things should be as easy as possible. The goal is to make content readable by anything. As more users access information through systems like ChatGPT instead of visiting websites directly, content that isn’t easily interpreted by AI crawlers risks becoming effectively invisible. see: https://github.com/ai-first-guides

ChatGPT makes the content visible and the author invisible. Why should anyone optimize for AI consumption?

Re: You can make up HTML tags

#163

Earlier quoted context omitted.

Mainly because it isn't semantic and breaks accessibility features. If you find yourself writing layouts like this you're probably ignoring a bunch of useful stuff like etc. Unless you manually configure it yourself, screen readers won't know what's important to read, tabindex won't know where to jump around, and form fields won't know what values to offer.

> isn't semantic It's certainly better than calling everything a div. > breaks accessibility features I don't know if I'd call it breakage to just... not use them where they should be used. Of course if a real tag exists that adequately matches the author's intent, that should be preferred over a made-up one.

> I don't know if I'd call it breakage to just... not use them where they should be used.

Accessibility only has 2 states: "Working" and "Broken", there's no third "I didn't bother".

Re: You can make up HTML tags

#164

Earlier quoted context omitted.

> isn't semantic It's certainly better than calling everything a div. > breaks accessibility features I don't know if I'd call it breakage to just... not use them where they should be used. Of course if a real tag exists that adequately matches the author's intent, that should be preferred over a made-up one.

> It's certainly better than calling everything a div. It's not. For semantic purposes is the same as . So on the surface they are equivalent. But if you are in the habit of using custom elements then you will likely continue to use them even when a more useful element is available so rather than so in practice it is probably worse even if theoretically identical. Basically divs with classes provide no semantic infor…

> For semantic purposes

But semantic purposes are not all possible purposes.

Re: You can make up HTML tags

#165

Earlier quoted context omitted.

> isn't semantic It's certainly better than calling everything a div. > breaks accessibility features I don't know if I'd call it breakage to just... not use them where they should be used. Of course if a real tag exists that adequately matches the author's intent, that should be preferred over a made-up one.

> It's certainly better than calling everything a div. It's not. For semantic purposes is the same as . So on the surface they are equivalent. But if you are in the habit of using custom elements then you will likely continue to use them even when a more useful element is available so rather than so in practice it is probably worse even if theoretically identical. Basically divs with classes provide no semantic infor…

> But if you are in the habit of using custom elements then you will likely continue to use them even when a more useful element is available

This article is written for web developers. I’m not sure who you think you are addressing with this comment.

In any case - the argument is a weak one. To the extent people make the mistake you allege they can make it with classed div and span tags as well and I’ve seen this in practice.

Re: You can make up HTML tags

#166

I've been doing this for about three or four years. Clever idea, tricky in practice. I don't think I'd recommend this approach broadly. But it works for me. It's definitely possible to take it too far. When most tags in your HTML are custom elements, it creates new readability problems. You can't immediately guess what's inline, what's block, etc. And it's just a lot of overhead for new people to learn. I've arrived…

> And yes, I abuse the slot attribute even when I'm only using CSS, without JS.

In CSS, how do you target based on the "hero-blurb" slot?

div[slot="hero-blurb"]?

Re: You can make up HTML tags

#167
post #114

Earlier quoted context omitted.

> I think it's a beautiful, elegant solution Very confused by statements like these. They are extremely verbose. They are too high level, preventing many low-level optimizations. They are too low-level, preventing you from using/implementing them without going into the details of how they actually work. They break many platform assumptions and conventions, creating no end of problems both for end users and implemente…

As far as I can tell, the whole web components umbrella came into being because React/Vue got really popular, and the spec/browser people said hey let's bring the core common denominator of those into native HTML/JS, as if it would bring us closer to having native Vue/React. Which of course never happened, partly because HTML is fundamentally incapable of having anything but string attribute values, and partly becaus…

> As far as I can tell, the whole web components umbrella came into being because React/Vue got really popular, and the spec/browser people said hey let's bring the core common denominator

First web components proposal is from 2011. First specs are from 2011-2013.

React was introduced in 2013 and didn't gain much traction until at least a year later.

Vuejs was publicly announced in 2014.

Re: You can make up HTML tags

#168

... a bunch more HTML ... Just one quibble over this specific example (not the broader concept, which is sound): it probably didn’t have to be div soup to begin with. Something like this may have been more reasonable: ... a bunch more HTML ...

Hot take: div soup isnt bad because html isn't purely structural. It's a natural consequence of a poor design decision. Div soup is a consequence of the design decision to couple html elements to styling, state management, etc.

It made sense in 1996. It does not make sense now.

Re: You can make up HTML tags

#169

Earlier quoted context omitted.

> isn't semantic It's certainly better than calling everything a div. > breaks accessibility features I don't know if I'd call it breakage to just... not use them where they should be used. Of course if a real tag exists that adequately matches the author's intent, that should be preferred over a made-up one.

> I don't know if I'd call it breakage to just... not use them where they should be used. Accessibility only has 2 states: "Working" and "Broken", there's no third "I didn't bother".

[deleted]

Re: You can make up HTML tags

#170

Earlier quoted context omitted.

Mainly because it isn't semantic and breaks accessibility features. If you find yourself writing layouts like this you're probably ignoring a bunch of useful stuff like etc. Unless you manually configure it yourself, screen readers won't know what's important to read, tabindex won't know where to jump around, and form fields won't know what values to offer.

> isn't semantic It's certainly better than calling everything a div. > breaks accessibility features I don't know if I'd call it breakage to just... not use them where they should be used. Of course if a real tag exists that adequately matches the author's intent, that should be preferred over a made-up one.

> > If you find yourself writing layouts like this you're probably ignoring a bunch of useful stuff like etc.

> It's certainly better than calling everything a div.

Yes but it's worse than etc. as the comment you are replying to mentions.

Post reply on HN