Live data from Hacker News

On The (2021)

benmyers.dev

41–50 of 138 posts

Re: On The <dl> (2021)

#41

The final example of the DnD statt sheet makes me think whether it's legal to nest s? I.e. can we do Actions ...

Yes. Any flow content is permitted inside a . See: https://html.spec.whatwg.org/#the-dd-element https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

Plus, when curious about formal syntactic correctness, there is the validator.w3.org [1].

[1] https://validator.w3.org/nu/?showsource=yes&showoutline=yes&...

Re: On The <dl> (2021)

#42

> 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.

Re: On The <dl> (2021)

#43

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.

Custom-named elements are divs.

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 what. Yes, you should use a more semantic element when it makes sense, but try to remember what that phrase actually means.

Re: On The <dl> (2021)

#44
post #35

Earlier quoted context omitted.

That's the problem.

most specifically the problem is that markdown tables don't allow breaking the table row in multiple lines but then you can always use HTML tables in markdown and Pandoc transforms it just fine


has worked fine whenever I’ve needed line breaking in markdown tables

Re: On The <dl> (2021)

#45
post #37

> 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.

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!

Re: On The <dl> (2021)

#46

Earlier quoted context omitted.

Custom-named elements are divs.

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.

Re: On The <dl> (2021)

#47
We've always used this in our ebooks for abbreviation and glossary lists. The problem I've always had is that you need to use a bit of css to make two lined-up columns. I've done it with floats. Now, some ebook readers will support grid and flex-box, which give better results, but the Kindle still does not. Kindle is sort of the IE6 of the ebook world.

Re: On The <dl> (2021)

#48
post #23

> Admittedly, however, support for the element is not yet universal. Wait what? has been in HTML since.. the first draft in 1993! I like DL's but they can be challenging to style. This article is using a lot of fixed pixel widths which would break on really small screens or larger data.

Granted, I do not know what I am doing with CSS, but the Character Sheet example seems standard flexible elements?

Some of the extracted CSS chunks

  #statblock{
    box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 10px 10px -5px rgba(0,0,0,.04);
    font-family:Lato,'Trebuchet MS',sans-serif;
    font-size:85%;
    min-width:50ch;
    max-width:70ch;
    margin-inline:auto;
    background-color:#fffaf0;
    padding-inline:2rem;
    padding-block:1rem
  }
  dl.statblock-bio{
    color:maroon;
    line-height:1.5;
    border-top:5px solid maroon;
    border-bottom:5px solid maroon;
    margin-block:0.75em;
    padding-block:0.75em
  }
  dl.ability-scores{
    min-width:40ch;
    display:flex;
    justify-content:space-around;
    color:maroon
  }
  dl.ability-scores>div{
    text-align:center;
    line-height:1.5
  }
  dl.ability-scores dt{
    font-weight:700
  }

Re: On The <dl> (2021)

#49

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.

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...

Re: On The <dl> (2021)

#50

> 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 term.
Post reply on HN