about summary refs log tree commit diff
path: root/app/assets
diff options
context:
space:
mode:
authorNoëlle Anthony <noelle.d.anthony@gmail.com>2017-04-30 09:12:14 -0400
committerMatt Jankowski <mjankowski@thoughtbot.com>2017-04-30 09:12:14 -0400
commitc67d3c990b29bd8e6ee47a2b83d7dad0b5788c2e (patch)
tree6f9238de1f7db1fc2a175303b9b9fb47e3b24956 /app/assets
parent2e47fe3e1a8087e1beda15b145aa9ce88fff1229 (diff)
Additional key checks for browser compatibility (#2539)
Not all browsers recognize e.key === 'Escape'; some use 'Esc' and some only respond to the keyCode.
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/components/features/ui/components/modal_root.jsx3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/assets/javascripts/components/features/ui/components/modal_root.jsx b/app/assets/javascripts/components/features/ui/components/modal_root.jsx
index cfaa8a598..23057715c 100644
--- a/app/assets/javascripts/components/features/ui/components/modal_root.jsx
+++ b/app/assets/javascripts/components/features/ui/components/modal_root.jsx
@@ -22,7 +22,8 @@ class ModalRoot extends React.PureComponent {
   }
 
   handleKeyUp (e) {
-    if (e.key === 'Escape' && !!this.props.type) {
+    if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
+         && !!this.props.type) {
       this.props.onClose();
     }
   }