mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-05-24 14:04:09 +03:00
Use named constants for magic numbers (#19992)
Mostly KeyboardEvent.which and MouseEvent.which values. [skip validator]
This commit is contained in:
+2
-1
@@ -25,6 +25,7 @@ const Modal = (($) => {
|
||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||
const TRANSITION_DURATION = 300
|
||||
const BACKDROP_TRANSITION_DURATION = 150
|
||||
const ESCAPE_KEYCODE = 27 // Escape (Esc) key
|
||||
|
||||
const Default = {
|
||||
backdrop : true,
|
||||
@@ -271,7 +272,7 @@ const Modal = (($) => {
|
||||
_setEscapeEvent() {
|
||||
if (this._isShown && this._config.keyboard) {
|
||||
$(this._element).on(Event.KEYDOWN_DISMISS, (event) => {
|
||||
if (event.which === 27) {
|
||||
if (event.which === ESCAPE_KEYCODE) {
|
||||
this.hide()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user