Hacker News new | past | comments | ask | show | jobs | submit login

Those libraries will come and go, but <dialog> is part of the HTML specification. I like to invest in learning things that are more likely to be around for a while.

On browsers, it's at 73% native support on caniuse, and the polyfill is high-quality, by the Chromium team.

As far as looks, it's all fully styleable with CSS so you can make it look however you like.




Those libraries will come and go, but <dialog> is part of the HTML specification. I like to invest in learning things that are more likely to be around for a while.

Historically it's more likely that an unpopular tag will be removed from the HTML spec and removed from browsers than JS will lose compatibility with your code.

For example, a JS flashing text effect from 25 years ago still works. <blink> tags don't.

Most tags that are deprecated in the spec aren't removed (eg marquee) but you shouldn't assume something in the spec will be available forever.


It's a fair point that specs evolve, and that sometimes includes deprecation. I do feel slightly aggrieved about the `scoped` style attribute being spec'd, implemented, and then dropped shortly thereafter.

But overall I feel this approach has worked well over the years. With jQuery for example, I only learned enough to get by working in those codebases, but I committed to internalized all of the standardized DOM methods and Array methods and naive XHR workings. Now in these modern times, jQuery still _works_, but whatever I came to know of it is no longer very useful to me, day to day.


Deprecated HTML tags are relatively rare though, especially more recently. You can pretty much categorize every one of them into tags that are purely concerned with styling, frame support and applet type things. And in all cases, the deprecation took a long time, long enough that it would outlive most apps.

And nowadays, even if dialog happened to be deprecated, you could always continue to support it using a custom element if you really needed to (which probably wouldn't be the worst approach even if you were building it from scratch, to be honest).


It’s even better than that, stylistically speaking. It’s the first element whose default styling, irrespective of the parent node, is naturally centred both vertically and horizontally with height and width constrained to content size (this alone being one of the CSS holy grails), but also explicitly sidestepping z-index issues even for elements within a nested stack context. All things a polyfill cannot do without caveats.


> On browsers, it's at 73% native support on caniuse

Alternatively: it works in Blink, but nowhere else.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: