by htunnicliff on 12/6/24, 7:09 PM with 153 comments
by divbzero on 12/7/24, 6:41 AM
File pickers:
<input type="file">
Color pickers: <input type="color">
Date/time pickers: <input type="month">
<input type="date">
<input type="time">
<input type="datetime-local">
Numeric sliders: <input type="range" min="0" max="5">
Suggested options for text fields: <input list="fonts">
<datalist id="fonts">
<option value="Courier New"></option>
<option value="Garamond"></option>
<option value="Georgia"></option>
<option value="Tahoma"></option>
<option value="Times New Roman"></option>
</datalist>
Summaries with expandable details: <h2>FAQs</h2>
<details name="faq">
<summary>Why are interactive HTML elements cool?</summary>
They’re lightweight and semantic!
</details>
<details name="faq">
<summary>Will the previous answer close when I open this one?</summary>
Yes, because the <code><details></code> elements share the same name.
</details>
Media players with controls: <audio controls src="example.mp3"></audio>
<video controls src="example.mp4"></video>
by DaiPlusPlus on 12/6/24, 7:39 PM
But my biggest let-down with the <dialog> element is that it's comnpletely unstyled, beyond a very basic (and very un-Chrome-like) thick black line pixel border with sharp edges. Whereas my-hope-and-expectation (and indeed: what got me interested in <dialog> in the first place) was that I was hoping that the browser itself would provide for a lot of the tedium involved in UI dialog dev-work in-general, especially for things like automaticallyt conforming to the host OS' conventions on dialog/window layout and placement: I was hoping that I could mark-up an actual semantic model of a dialog and the browser would do the hard-work of making it look like a real native macOS (or iOS) - or Windows - dialog resource.
I was also hoping that, because open <dialog> elements exist in a distinct top-level layer, that they might even able to escape the bounds of the browser viewport, which would provide real value to the end-user in a lot of places (e.g. no-one wants an unmovable popup or modal-dialog that completely obscures the user's view of an underlying document (like macOS's old "Sheets" dialogs) - so another false-hope of mine got popped that day.
-----
I get the feeling that browser vendors would all like to see us stop using `alert()`, `prompt()` and `confirm()` in JavaScript (because they block the JS/main thred), but the same browser-vendors really haven't come-up with an adequate replacement: the beeauty of alert/prompt/confirm is that their API is incredibly simple yet effective and also doesn't require the proggrammer to have any UI design-skills; I don't understand why browsers still don't offer a non-blocking Promie-based API for alert/prompt/confirm instead of them trying, in vain, to convince us that <dialog> is better in every situastion when it clearly isn't. ]
by lapcat on 12/6/24, 7:31 PM
by pier25 on 12/7/24, 12:42 AM
There's a <combobox> proposal in the works which is like a <select> on steroids [1].
Also the Popover API [1] already in browsers for toast alerts. And a popover hint proposal for tooltips[2].
[1] https://open-ui.org/components/combobox.explainer/
[2] https://mdn.github.io/dom-examples/popover-api/
[3] https://open-ui.org/components/popover-hint.research.explain...
by somishere on 12/7/24, 3:15 AM
That said, my one major bugbear with it is the reliance on javascript. Yep, I expect all* users on my sites to arrive with JS enabled. But I also (selfishly?) derive some satisfaction from them not having to. Why can't I control the dialog's open state with CSS or a targeted button?
Would love to learn I'm wrong about this.
by pkphilip on 12/7/24, 4:39 AM
Each PAGE should be able to pull in common sections from the same page such as the header, sidebar, footer etc based on specific states selectable in each PAGE.
Yes, you can do the same thing with the current approaches by hiding and showing divs etc.. But if it were possible to support these approaches via specific tags in HTML it may help.
EXAMPLE:
<COMMON>
<script>
.. common javascript elements here
</script>
<SECTION id="header">
...
</SECTION>
<SECTION id="sidebar">
...
</SECTION>
<SECTION id="footer">
...
</SECTION>
</COMMON>
<PAGE default name="Home">
<INCLUDE from="header"/>
<INCLUDE from="sidebar"/>
<DIV>
.....
</DIV>
<INCLUDE from="footer"/>
</PAGE>
<PAGE name="Login">
<INCLUDE from="header"/>
<DIV>
.....
</DIV>
<INCLUDE from="footer"/>
</PAGE>
<PAGE name="Profile">
<INCLUDE from="header"/>
<INCLUDE from="sidebar"/>
<DIV>
.....
</DIV>
<INCLUDE from="footer"/>
</PAGE>
by andypants on 12/6/24, 8:25 PM
Normally a form will reload the page anyways so I guess this isn't a normal problem but I was using htmx.
by replete on 12/6/24, 11:15 PM
Dialog works well for the most part, with a couple of CSS kludges here and there for the older browsers but otherwise straightforward to deal with. It's a decent addition to the web platform, but after 20 years of this I would like to stop making custom multi select controls every couple of years. Native controls good.
by Sateeshm on 12/6/24, 7:40 PM
by silverwind on 12/7/24, 12:18 AM
by poincaredisk on 12/7/24, 6:19 PM
This perplexes me. Why is it not recommended? Why put it in a standard and then recommend against it? What's wrong with it? The documentation is silent.
by srathi on 12/6/24, 8:29 PM
by quantadev on 12/6/24, 11:05 PM
by joshdavham on 12/6/24, 9:40 PM
by troupo on 12/6/24, 9:33 PM
And then boom! It was shipped everywhere with none of the issues discussed or fixed.
Why?
My tiny conspiracy theory is because browsers are hellbent on removing "legacy" APIs like confirm/prompt, and Chrome tried to remove it about half-a-year to a year before <dialog> was suddenly shipped everywhere: https://dev.to/richharris/stay-alert-d
by tanepiper on 12/7/24, 10:34 AM
https://tane.dev/2021/02/revisiting-dark-patterns-with-the-h...
by palsecam on 12/6/24, 8:21 PM
Vignettes set their `z-index` CSS property to the max (2147483647), but a <dialog> is still higher on the z-plane (with no way to adjust that).
So if you click a link from a <dialog>, and an interstitial gets displayed, it’s under the <dialog>. It looks like nothing happened, that clicking is broken.
Fix in my case was to close() the <dialog> onclick.
by ulrischa on 12/6/24, 7:31 PM