From 911d779bd4d24c5802c937932f29cb7ed2aebfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adem=C3=ADlson=20F=2E=20Tonato?= <5417662+ftonato@users.noreply.github.com> Date: Tue, 1 Oct 2019 20:24:31 +0100 Subject: [PATCH] fix(ButtonDropdown): add close event when Escape key is pressed (#1634) (#1635) fixes #1634 --- src/Dropdown.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Dropdown.js b/src/Dropdown.js index 8f35a915b..2fa6e33e5 100644 --- a/src/Dropdown.js +++ b/src/Dropdown.js @@ -130,6 +130,8 @@ class Dropdown extends React.Component { ) { this.toggle(e); setTimeout(() => this.getMenuItems()[0].focus()); + } else if (this.props.isOpen && e.which === keyCodes.esc) { + this.toggle(e); } }