Skip to content

Commit

Permalink
overlay: fix use of deprecated which
Browse files Browse the repository at this point in the history
This replaces use of the deprecated keyboard event `which` property
with the proper `key` property.

Issue: #4165
  • Loading branch information
dlech committed Jun 2, 2022
1 parent 2f76b9f commit 268ab68
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/core/src/components/overlay/overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,7 @@ export class Overlay extends AbstractPureComponent2<OverlayProps, IOverlayState>

private handleKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {
const { canEscapeKeyClose, onClose } = this.props;
// HACKHACK: https://github.com/palantir/blueprint/issues/4165
/* eslint-disable-next-line deprecation/deprecation */
if (e.which === Keys.ESCAPE && canEscapeKeyClose) {
if (e.key === "Escape" && canEscapeKeyClose) {
onClose?.(e);
// prevent browser-specific escape key behavior (Safari exits fullscreen)
e.preventDefault();
Expand Down

0 comments on commit 268ab68

Please sign in to comment.