-
Notifications
You must be signed in to change notification settings - Fork 55
fix: escape behavior of popup and dropdown #1183
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1183 +/- ##
==========================================
- Coverage 82.46% 82.45% -0.01%
==========================================
Files 735 735
Lines 8723 8726 +3
Branches 1169 1169
==========================================
+ Hits 7193 7195 +2
- Misses 1514 1515 +1
Partials 16 16
Continue to review full report at Codecov.
|
I tested in the docsite with selection and search PRs. Esc looks fixed, although I am not sure why the popup closes when you click on the search input text. or when you Tab into it and then hit Enter. This happens in this PR, I tried to repro in that sandbox from the issue and it was ok there. Used the code below in the Inline example in the Docsite.
|
this.close(e, () => _.invoke(this.triggerFocusableDomElement, 'focus')) | ||
e.stopPropagation() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it needed to stop propagation in the popup? As far as understood, the problem was caused in Dropdown which was propagating keyboard event to Popup. Seems like Dropdown changes should fix it, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe Dropdown in Popup will be usually used with focus trap behavior. This PR #1180 stop propagation for any keyboard events within FocusTrapZone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sophieH29 why is it needed to stop propagation in the popup? As far as understood, the problem was caused in Dropdown which was propagating keyboard event to Popup
Actually, this makes just one aspect of the problem, the one that is replicated with the codesandbox example in the issue description: #1079 . If it would be the only problem, than yes, changes to the Dropdown
would be enough.
However, as it is mentioned in the issue, the same problem applies to Popup -> Popup case, and this behavior is not correct (from issue's description):
The same result will be for multiple Popups.
@sophieH29 I believe Dropdown in Popup will be usually used with focus trap behavior. This PR #1180 stop propagation for any keyboard events within FocusTrapZone
Yes, it should - however, in the meanwhile this fix is necessary
Fixes #1079 .
The issue was caused by the fact that Esc key event was propagated further in the components tree, even being processed by
Popup
/Dropdown
. Necessary instructions to prevent propagation were added to the code.