Hacker News new | ask | show | jobs
by myfonj 771 days ago
And also <details> if you need expanding/collapsing content, or, with a slight abuse, a "dropdown".

Strange that unlike <dialog open> and <details open>, `<whatever popover>` apparently lacks the the ability to be made declaratively `open` using the attribute. This feels like omission to me. I hope there is some based reasoning behind this decision.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/de...

1 comments

Maybe because 'dialog' says "don't do that" but everybody did anyway?

(also possibly because the "insert into top layer" is sufficiently odd a thing to trigger that the designers felt representing it as an attribute was a worse idea than for dialog)

... though I'd really like some sort of explanation as to how to choose between "non-modal <dialog>" and popover because the one thing I am very confident of here is that I don't know enough to answer that question myself.

Yes, it was clarified in a Twitter thread [1].

As I understand the line of thought around modals there it is: If it has to be declaratively opened modal on each page visit, blocking other content, it should better be an extra page anyway. (The fact it is made possible imperatively with JS is considered "necessary evil" as I understand it.) The same presumably applies for popover; default-open popover could probably make sense in application that uses JS anyway, not a static document. (?)

Nuances of distinction between popover and non-modal dialog I have to explore.

[1] https://twitter.com/myfonj/status/1789238215771037836