Skip to content

[IDEA] Use <dialog> and .showModal() for modals #9593

@yaisog

Description

@yaisog

The <dialog> element was designed for this. It can be put anywhere in the DOM, being hidden, and gets lifted to the browsers top rendering layer with .showModal(). There is automatic background dimming, focus trapping, ESC key handling and more.
A drawback is that some browsers (Firefox, Safari) did not support this before 2022, so it doesn't match our baseline.

I made a demo PR #9587 using it, which also gets rid of the rigid header-body-footer modal structure in place of the template / cascade-based system (which isn't very polished, yet) for testing and feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionable:codeThe issue contains tested code-snippets that may be usable to implement the functionalitynewfeatureNew functionality that does not presently exist

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions