Problem
When a Tearsheet opens another modal, such as a file-selection modal, pressing
Escape closes both the modal and the underlying Tearsheet.
This suggests that the Escape-key event is being handled by multiple layers rather
than only by the active topmost layer. With stacked Tearsheets, the same behavior
could dismiss multiple workflow levels with a single keypress and unexpectedly
discard in-progress work.
Steps to reproduce
-
Open a Tearsheet.
-
Open a modal or file-selection flow from within the Tearsheet.
-
Press Escape.
-
Observe that both the nested modal and the underlying Tearsheet close.
-
Repeat with multiple stacked Tearsheets and verify whether one Escape
dismisses more than the active layer.
Here I hit escape to cancel out of the modal but all views are closed:

Expected behavior
Pressing Escape should dismiss only the active topmost modal or Tearsheet.
Underlying layers should remain open, and the event should not continue to
trigger their close handlers.
Context
This was observed in
odh-dashboard#9589.
The follow-up discussion is
here.
Related stacked-modal accessibility work:
Jira Issue: PF-4706
Problem
When a Tearsheet opens another modal, such as a file-selection modal, pressing
Escapecloses both the modal and the underlying Tearsheet.This suggests that the Escape-key event is being handled by multiple layers rather
than only by the active topmost layer. With stacked Tearsheets, the same behavior
could dismiss multiple workflow levels with a single keypress and unexpectedly
discard in-progress work.
Steps to reproduce
Open a Tearsheet.
Open a modal or file-selection flow from within the Tearsheet.
Press
Escape.Observe that both the nested modal and the underlying Tearsheet close.
Repeat with multiple stacked Tearsheets and verify whether one
Escapedismisses more than the active layer.
Here I hit escape to cancel out of the modal but all views are closed:
Expected behavior
Pressing
Escapeshould dismiss only the active topmost modal or Tearsheet.Underlying layers should remain open, and the event should not continue to
trigger their close handlers.
Context
This was observed in
odh-dashboard#9589.
The follow-up discussion is
here.
Related stacked-modal accessibility work:
react-component-groups#966
patternfly-react#12557
patternfly-react#12608
Jira Issue: PF-4706