Modal dialogs without React (or JavaScript)
laktek.com·4h·
Discuss: Hacker News
Flag this post

This is probably old news, but it went under my radar.

This weekend, I was tinkering with a little hobby project and stumbled on MDN docs for <button> element. I noticed a relatively unfamiliar command attribute, which can take values such as “show-modal” and “request-close”, among others.

This led me to discover the native HTML <dialog> element, which is supported by all major browsers for quite some time (Safari and Safari iOS added it in version 15.4, which was released more than 3 years ago). All front-end code bases I’ve touched in the past 5-6 years would use some React-based UI library, and it would have its own …

Similar Posts

Loading similar posts...