Parcourir la source

Additional key checks for browser compatibility (#2539)

Not all browsers recognize e.key === 'Escape'; some use 'Esc' and some only respond to the keyCode.
master
Noëlle Anthony il y a 7 ans
committed by Matt Jankowski
Parent
révision
c67d3c990b
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. +2
    -1
      app/assets/javascripts/components/features/ui/components/modal_root.jsx

+ 2
- 1
app/assets/javascripts/components/features/ui/components/modal_root.jsx Voir le fichier

@@ -22,7 +22,8 @@ class ModalRoot extends React.PureComponent {
} }


handleKeyUp (e) { 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(); this.props.onClose();
} }
} }


Chargement…
Annuler
Enregistrer