Skip to content

Support disabling CloseWatcher integration in <dialog> #10592

@lucacasonato

Description

@lucacasonato

What problem are you trying to solve?

Right now one can not really use <dialog> to grab the users attention until they complete some action. This is because <dialog> always lets the user close it through native UI, even when the developer explicitly does not want to allow this (ie when using cancel events). This is done in HTML to prevent malicious sites from blocking the Android back button. This is good!

However, there are genuine use cases for unclosable <dialog>:

  • a upload progress modal that prevents the user from continuing until the upload is done
  • a "Please accept our terms of service" modal after signing in that should not be dismissable, because a user must accept TOS before using the service
  • a required action before progress can be made, such as a "Please enter your name" modal before you can join a video call / online game

As such, it would be great if we had a way to open an unclosable dialog. This dialog would not have any CloseWatcher integration at all: pressing escape or the Android back button would completely bypass the dialog and instead do their default behaviour (like navigate back in the navigation history).

What solutions exist today?

No solutions using the native <dialog> element. One would have to reimplement the behaviour.

A solution that will probably be gone soon: https://issues.chromium.org/issues/363225474

How would you solve it?

dialog.showModal({ closeBehaviour: "manual" });

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interesttopic: dialogThe <dialog> element

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions