Skip to content

[Feat]: Allow overlays to decide if they can be closed or not #1853

@sorinsarca

Description

@sorinsarca

Code of conduct

  • I agree to follow this project's code of conduct.

Impacted component(s)

overlay

Description of the requested feature

The main problem starts here https://github.com/adobe/spectrum-web-components/blob/main/packages/overlay/src/overlay-stack.ts#L495-L501

Pressing Escape will close the overlay no matter what, and this is problematic for some modals.

Imagine that we have an upload dialog, once the user clicks the "Upload" button the process begins, and a progress bar is
updated from 0% to 100% indicating the upload status. In this particular case the process is not cancellable, the user must wait until the upload is complete, otherwise the app will be (lets say) in some undefined state. Now, if the user accidentally hits Escape the dialog will close, and lots of errors will appear (because the progress bar no longer exists, but the async process tries to update it, or some other errors).

Currently the only option is to monkey-patch and set handleKeyUp method to nop, which completely disables the Escape close mode.

Mockups or screenshots

No response

Implementation notes or ideas

Maybe some isClosable property?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions