[Feat]: Allow overlays to decide if they can be closed or not #1853
Labels
Component: Overlay
enhancement
New feature or request
Needs discussion
Proposed UX or spec changes
Overlay v2 Confirmed
Post overlay API
Review after Overlay V2 Ships
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 theEscape
close mode.Mockups or screenshots
No response
Implementation notes or ideas
Maybe some
isClosable
property?The text was updated successfully, but these errors were encountered: