SMRTR ProgrammingAug 26, 2025Go Make Things

How to dismiss native HTML dialog elements when the backdrop is clicked

SMRTR summary

HTML dialog elements now support easier modal dismissal with the new [closedby] attribute. While dialogs normally close via JavaScript methods, formmethod buttons, or the Esc key, they don't automatically close when users click outside the modal (light dismissal). The [closedby="any"] attribute adds this functionality without complex JavaScript calculations previously needed to determine if clicks occurred outside the dialog. This feature works in most browsers except Safari, making it a useful progressive enhancement for creating more intuitive user interfaces.

SMRTR provides this summary for quick context. The original article belongs to Go Make Things.

Read the original article
SMRTR Programming

Get the next batch of curated summaries in your inbox.

This archive is built from SMRTR newsletter summaries. Subscribe for hand-picked stories without the extra noise.