diff options
| author | Tanguy Krotoff <[email protected]> | 2020-04-15 16:52:18 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-04-17 18:22:15 +0300 |
| commit | dcd99aa7d1cb8018a1378bc75053853e07edbfff (patch) | |
| tree | 7cf92cdba5a9d0dc1b04a7b90055bfcdaaeecb21 /js/src/modal.js | |
| parent | 8547ab149a9406937c0ec4f0c7864a8884b63d64 (diff) | |
| download | bootstrap-dcd99aa7d1cb8018a1378bc75053853e07edbfff.tar.xz bootstrap-dcd99aa7d1cb8018a1378bc75053853e07edbfff.zip | |
Replace event.which with event.key and event.button
Diffstat (limited to 'js/src/modal.js')
| -rw-r--r-- | js/src/modal.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/js/src/modal.js b/js/src/modal.js index d5f1c8c9a..0daa428a8 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -31,7 +31,7 @@ const VERSION = '4.3.1' const DATA_KEY = 'bs.modal' const EVENT_KEY = `.${DATA_KEY}` const DATA_API_KEY = '.data-api' -const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key +const ESCAPE_KEY = 'Escape' const Default = { backdrop: true, @@ -299,10 +299,10 @@ class Modal { _setEscapeEvent() { if (this._isShown) { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { - if (this._config.keyboard && event.which === ESCAPE_KEYCODE) { + if (this._config.keyboard && event.key === ESCAPE_KEY) { event.preventDefault() this.hide() - } else if (!this._config.keyboard && event.which === ESCAPE_KEYCODE) { + } else if (!this._config.keyboard && event.key === ESCAPE_KEY) { this._triggerBackdropTransition() } }) |
