Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit a5d017b

Browse files
authored
fix: escape behavior of popup and dropdown (#1183)
* introduce fix * update changelog
1 parent 3905d6f commit a5d017b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3030
- Truncate `content` and `header` of `ListItem` when used from `DropdownSelectedItem` @silviuavram ([#1161](https://github.com/stardust-ui/react/pull/1161))
3131
- Fix `rotate` prop on `Icon` not working in `rtl` @mnajdova ([#1179](https://github.com/stardust-ui/react/pull/1179))
3232
- `FocusTrapZone` - Do not propagate any keyboard events @sophieH29 ([#1180](https://github.com/stardust-ui/react/pull/1180))
33+
- Capture effect of `Esc` key down event within component for `Popup` and `Dropdown` @kuzhelov ([#1183](https://github.com/stardust-ui/react/pull/1183))
3334

3435
<!--------------------------------[ v0.26.0 ]------------------------------- -->
3536
## [v0.26.0](https://github.com/stardust-ui/react/tree/v0.26.0) (2019-04-03)

packages/react/src/components/Dropdown/Dropdown.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ class Dropdown extends AutoControlledComponent<Extendable<DropdownProps>, Dropdo
928928
case keyboardKey.Escape:
929929
accessibilityInputPropsKeyDown(e)
930930
this.tryFocusTriggerButton()
931+
e.stopPropagation()
931932
return
932933
default:
933934
accessibilityInputPropsKeyDown(e)

packages/react/src/components/Popup/Popup.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,13 @@ export default class Popup extends AutoControlledComponent<ReactProps<PopupProps
199199

200200
protected actionHandlers: AccessibilityActionHandlers = {
201201
closeAndFocusTrigger: e => {
202-
e.stopPropagation()
203202
this.close(e, () => _.invoke(this.triggerFocusableDomElement, 'focus'))
203+
e.stopPropagation()
204+
},
205+
close: e => {
206+
this.close(e)
207+
e.stopPropagation()
204208
},
205-
close: e => this.close(e),
206209
toggle: e => {
207210
e.preventDefault()
208211
this.trySetOpen(!this.state.open, e)

0 commit comments

Comments
 (0)