Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Fixed `EuiToolTip` closing during initial positioning period ([#4327](https://github.com/elastic/eui/pull/4327))
- Added `!default` to SASS variables of `EuiCollapsibleNav` ([#4335](https://github.com/elastic/eui/pull/4335))
- Fixed `EuiDataGrid` column property `displayAsText`. Column headers prefer `displayAsText` over `id`; `display` still takes precedence. If provided, the filter in the sort-popover will search against `displayAsText` instead of `id`. ([#4351](https://github.com/elastic/eui/pull/4351))
- Fixed propagation of `esc` key presses closing parent popovers ([#4336](https://github.com/elastic/eui/pull/4336))


**Theme: Amsterdam**
Expand Down
7 changes: 5 additions & 2 deletions src/components/combo_box/combo_box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,11 @@ export class EuiComboBox<T> extends Component<
break;

case keys.ESCAPE:
event.stopPropagation();
this.closeList();
if (this.state.isListOpen) {
event.preventDefault();
event.stopPropagation();
this.closeList();
}
break;

case keys.ENTER:
Expand Down
12 changes: 10 additions & 2 deletions src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,17 @@ export class EuiPopover extends Component<Props, State> {
}
};

onEscapeKey = (event: Event) => {
if (this.props.isOpen) {
event.preventDefault();
event.stopPropagation();
this.closePopover();
}
};

onKeyDown = (event: KeyboardEvent) => {
if (event.key === cascadingMenuKeys.ESCAPE) {
this.closePopover();
this.onEscapeKey((event as unknown) as Event);
}
};

Expand Down Expand Up @@ -724,7 +732,7 @@ export class EuiPopover extends Component<Props, State> {
initialFocus={initialFocus}
onDeactivation={onTrapDeactivation}
onClickOutside={this.onClickOutside}
onEscapeKey={this.closePopover}
onEscapeKey={this.onEscapeKey}
disabled={
!ownFocus || !this.state.isOpenStable || this.state.isClosing
}>
Expand Down