diff --git a/CHANGELOG.md b/CHANGELOG.md index 1514047c55..a528b551c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Truncate `content` and `header` of `ListItem` when used from `DropdownSelectedItem` @silviuavram ([#1161](https://github.com/stardust-ui/react/pull/1161)) - Fix `rotate` prop on `Icon` not working in `rtl` @mnajdova ([#1179](https://github.com/stardust-ui/react/pull/1179)) - `FocusTrapZone` - Do not propagate any keyboard events @sophieH29 ([#1180](https://github.com/stardust-ui/react/pull/1180)) +- Capture effect of `Esc` key down event within component for `Popup` and `Dropdown` @kuzhelov ([#1183](https://github.com/stardust-ui/react/pull/1183)) ## [v0.26.0](https://github.com/stardust-ui/react/tree/v0.26.0) (2019-04-03) diff --git a/packages/react/src/components/Dropdown/Dropdown.tsx b/packages/react/src/components/Dropdown/Dropdown.tsx index 1b5d967bc4..33a6ee81f4 100644 --- a/packages/react/src/components/Dropdown/Dropdown.tsx +++ b/packages/react/src/components/Dropdown/Dropdown.tsx @@ -928,6 +928,7 @@ class Dropdown extends AutoControlledComponent, Dropdo case keyboardKey.Escape: accessibilityInputPropsKeyDown(e) this.tryFocusTriggerButton() + e.stopPropagation() return default: accessibilityInputPropsKeyDown(e) diff --git a/packages/react/src/components/Popup/Popup.tsx b/packages/react/src/components/Popup/Popup.tsx index fd2a588715..30f4742680 100644 --- a/packages/react/src/components/Popup/Popup.tsx +++ b/packages/react/src/components/Popup/Popup.tsx @@ -199,10 +199,13 @@ export default class Popup extends AutoControlledComponent { - e.stopPropagation() this.close(e, () => _.invoke(this.triggerFocusableDomElement, 'focus')) + e.stopPropagation() + }, + close: e => { + this.close(e) + e.stopPropagation() }, - close: e => this.close(e), toggle: e => { e.preventDefault() this.trySetOpen(!this.state.open, e)