Live data from Hacker News

On The (2021)

benmyers.dev

51–60 of 138 posts

Re: On The <dl> (2021)

#52

Earlier quoted context omitted.

Exactly! It cracks me up when people name-check "semantic elements" when it doesn't actually mean anything in that context. Accessibility software doesn't understand the semantics of your custom elements, so there is no benefit in that situation whatsoever. Maybe it's easier for you to read and edit in the future, but that's it. Somehow, people got convinced that elements are evil and should never be used no matter w…

I use it for readability and to express intention and meaning to the reader of my program. In the age of AI, perhaps, we've lost the need for that. But it was much appreciated in times before by those who came upon my code.

That's great! There's nothing wrong with that.

However, "semantic elements" became popular shortly after the push for the "semantic web" which was entirely based around making the web easier to process for machines. Many of the original sources talk about how it's easier to digest for humans too, but that's just a happy byproduct.

https://www.w3.org/DesignIssues/Semantic.html

https://www.lassila.org/publications/2001/SciAm.pdf

https://informationr.net/ir/7-4/paper134.html

https://jonchristopher.us/blog/a-semantic-breakdown-of-resta...

https://shapeshed.com/the-importance-of-semantic-markup/

https://www.w3.org/TR/html-design-principles/

https://microformats.org/wiki/posh

Re: On The <dl> (2021)

#53
post #37

Earlier quoted context omitted.

I don’t want to check what year html5 was standardized because I think it may be north of a decade ;)

> I think it may be north of a decade Nearly two!

I was better off not knowing that this morning. Might be worth prefixing that tidbit of info with “trigger warning: the unrelenting passage of time”.

Re: On The <dl> (2021)

#54

> Prior to HTML5, this was called a definition list. This is because the was originally only intended to represent glossaries of terms and their definitions. TIL I’ve been naming it wrong for a decade.

TIL The name was changed from a definition list.

Same here. I like definition list better ;-)

Re: On The <dl> (2021)

#55

> Prior to HTML5, this was called a definition list. This is because the was originally only intended to represent glossaries of terms and their definitions. TIL I’ve been naming it wrong for a decade.

You’re not alone. This is the second time this week I’ve seen that, and thought it was a mistake the first time.

Re: On The <dl> (2021)

#56

Earlier quoted context omitted.

Custom-named elements are divs.

They're not as you can see here[1] and here[2]. They both inherit from the HTMLElement interface but div is considered an HTMLDivElement which makes it distinct from a custom element. != [1] https://developer.mozilla.org/en-US/docs/Web/API/Web_compone... [2] https://developer.mozilla.org/en-US/docs/Web/API/HTMLDivElem...

[deleted]

Re: On The <dl> (2021)

#57

I'm curious if the spec actually says you can only wrap it with a div because I like to do semantic html and name my elements specific to my domain.

As others have noted only the div is allowed. This isn't a unique situation either, the HTML spec despite being lenient in syntax is quite restrictive in behavior. It's unfortunate that XHTML (and XML parsing) didn't become the default as it's the opposite, more restrictive syntax, but lenient behavior.

For example in XHTML you can use custom elements as table rows or cells (provided you give them the correct role and CSS display property). This is because XHTML does not modify the tree during parsing, unlike HTML which will hoist out custom element children of the table to the table's parent.

Re: On The <dl> (2021)

#58

> This is incorrect: 1. has no corresponding ( viz. implicit) role, but can be given the role group, list, none or presentation https://w3c.github.io/html-aria/#el-dl >. 2. You’re only allowed to define aria-label on elements that have a compatible role, implicit or explicit https://w3c.github.io/html-aria/#docconformance-naming >. 3. aria-label is allowed on all but a handful of roles https://www.w3.org/TR/wai-aria-…

[dead]

Re: On The <dl> (2021)

#59

The tag seems to cover a subset of a broad semantic space, but doesn’t easily extend beyond adding another . I dunno, I guess I’m a caveman. If it looks right and works (including accessibility) then I figure I’m pursuing something that doesn’t matter a lot.

Shameless plug: you might be interested in https://calvinlc.com/p/2026/02/11/everything-is-a-div.html

I need to learn more about web accessibility, but if you completely ignore it (and other sane practices) HTML looks really simple.

I think the design of HTML is just too much. There’s so many tags that don’t do much. It’s like w3c decided that any common thing people use in websites needs a tag. The end result is more and more tags…

Can anyone convince me otherwise? It screams design red-flags to me.

PS: I love the web and think it’s the best platform and future platform we have at the moment. It’s just quirky and loves not breaking old websites!

Re: On The <dl> (2021)

#60

> This is incorrect: 1. has no corresponding ( viz. implicit) role, but can be given the role group, list, none or presentation https://w3c.github.io/html-aria/#el-dl >. 2. You’re only allowed to define aria-label on elements that have a compatible role, implicit or explicit https://w3c.github.io/html-aria/#docconformance-naming >. 3. aria-label is allowed on all but a handful of roles https://www.w3.org/TR/wai-aria-…

Wow I have never noticed that, thanks for the heads up! Out of curiosity, would you put `role="listitem"` on ` ` elements that wrap the ` ` && ` ` elements? It looks like `role="listitem"` is allowed on the ` ` element, but that doesn't feel like it would be accurate in the case where multiple ` ` elements are grouped together, and I'm not sure if that would mess with how the element is interpreted natively as as ter…

I know the fundamentals of this sort of thing, but I haven’t done much practical with it, so I don’t feel that I can comment on this point.
Post reply on HN