dialog
elementWhich AI frontend dev tool reigns supreme in July 2025? Check out our power rankings and use our interactive comparison tool to find out.
Learn how OpenAPI can automate API client generation to save time, reduce bugs, and streamline how your frontend app talks to backend APIs.
Discover how the Interface Segregation Principle (ISP) keeps your code lean, modular, and maintainable using real-world analogies and practical examples.
<selectedcontent>
element improves dropdowns
is an experimental HTML element that gives developers control over how a selected option is displayed, using just HTML and CSS.
3 Replies to "Why you should be using the <code>dialog</code> element"
it’s still not nearly supported enough to use in production, check caniuse – 76%
Hey Karol,
By using it in the production I meant the dialog element is supported by all the modern browsers except a few obscure browsers, such as IE, Opera Mini, KaiOS browser, UC browser etc, that still doesn’t support the dialog element.
The market share of these browsers is fairly low at this point. And that’s why I said it’s safe to use it in the production.
You can use another way that is much simpler for detecting outside click:
“`
const listener = (event: Event) => {
if (
event.target !== collectEmail &&
event.composedPath().includes(collectEmail)
) {
return;
}
// clicked outside the `collectEmail `
};
“`
You’re welcome 🙂