diff options
| author | Pierre-Denis Vanduynslager <[email protected]> | 2017-01-15 10:33:54 -0500 |
|---|---|---|
| committer | Pierre-Denis Vanduynslager <[email protected]> | 2017-01-15 10:33:54 -0500 |
| commit | a85b80fa75aa9ecc7da252411f6209a002e4bdfb (patch) | |
| tree | 90f7083626b4471afe47702bc8567a4918b0313b /js | |
| parent | 4c2f5443596c39c551ebb7ec635d01a98e434189 (diff) | |
| parent | 8fbd4aaa383e3506d2da3c2335eeb66f494f07ad (diff) | |
| download | bootstrap-a85b80fa75aa9ecc7da252411f6209a002e4bdfb.tar.xz bootstrap-a85b80fa75aa9ecc7da252411f6209a002e4bdfb.zip | |
Merge branch 'twbs/v4-dev' into dropdown-keyboard
Diffstat (limited to 'js')
| -rw-r--r-- | js/src/carousel.js | 8 | ||||
| -rw-r--r-- | js/src/dropdown.js | 4 | ||||
| -rw-r--r-- | js/tests/visual/collapse.html | 2 | ||||
| -rw-r--r-- | js/tests/visual/modal.html | 2 |
4 files changed, 9 insertions, 7 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index d27600c40..8a75cb240 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -137,7 +137,7 @@ const Carousel = (($) => { if (this._isSliding) { throw new Error('Carousel is sliding') } - this._slide(Direction.PREVIOUS) + this._slide(Direction.PREV) } pause(event) { @@ -195,7 +195,7 @@ const Carousel = (($) => { const direction = index > activeIndex ? Direction.NEXT : - Direction.PREVIOUS + Direction.PREV this._slide(direction, this._items[index]) } @@ -263,7 +263,7 @@ const Carousel = (($) => { _getItemByDirection(direction, activeElement) { const isNextDirection = direction === Direction.NEXT - const isPrevDirection = direction === Direction.PREVIOUS + const isPrevDirection = direction === Direction.PREV const activeIndex = this._getItemIndex(activeElement) const lastItemIndex = this._items.length - 1 const isGoingToWrap = isPrevDirection && activeIndex === 0 || @@ -273,7 +273,7 @@ const Carousel = (($) => { return activeElement } - const delta = direction === Direction.PREVIOUS ? -1 : 1 + const delta = direction === Direction.PREV ? -1 : 1 const itemIndex = (activeIndex + delta) % this._items.length return itemIndex === -1 ? diff --git a/js/src/dropdown.js b/js/src/dropdown.js index cbce5e774..200f31569 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -24,9 +24,11 @@ const Dropdown = (($) => { const DATA_API_KEY = '.data-api' const JQUERY_NO_CONFLICT = $.fn[NAME] const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key + const SPACE_KEYCODE = 32 // KeyboardEvent.which value for space key const ARROW_UP_KEYCODE = 38 // KeyboardEvent.which value for up arrow key const ARROW_DOWN_KEYCODE = 40 // KeyboardEvent.which value for down arrow key const RIGHT_MOUSE_BUTTON_WHICH = 3 // MouseEvent.which value for the right button (assuming a right-handed mouse) + const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEYCODE}|${ARROW_DOWN_KEYCODE}|${ESCAPE_KEYCODE}|${SPACE_KEYCODE}`) const Event = { HIDE : `hide${EVENT_KEY}`, @@ -211,7 +213,7 @@ const Dropdown = (($) => { } static _dataApiKeydownHandler(event) { - if (!/(38|40|27|32)/.test(event.which) || + if (!REGEXP_KEYDOWN.test(event.which) || /input|textarea/i.test(event.target.tagName)) { return } diff --git a/js/tests/visual/collapse.html b/js/tests/visual/collapse.html index d16a1b0f2..21b11a257 100644 --- a/js/tests/visual/collapse.html +++ b/js/tests/visual/collapse.html @@ -10,7 +10,7 @@ <div class="container"> <h1>Collapse <small>Bootstrap Visual Test</small></h1> - <div id="accordion" role="tablist" aria-multiselectable="true"> + <div id="accordion" role="tablist"> <div class="card"> <div class="card-header" role="tab" id="headingOne"> <h5 class="mb-0"> diff --git a/js/tests/visual/modal.html b/js/tests/visual/modal.html index 33af36c5f..3aca0c96f 100644 --- a/js/tests/visual/modal.html +++ b/js/tests/visual/modal.html @@ -54,7 +54,7 @@ <h4>Tooltips in a modal</h4> <p><a href="#" data-toggle="tooltip" data-placement="top" title="Tooltip on top">This link</a> and <a href="#" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">that link</a> should have tooltips on hover.</p> - <div id="accordion" role="tablist" aria-multiselectable="true"> + <div id="accordion" role="tablist"> <div class="card"> <div class="card-header" role="tab" id="headingOne"> <h5 class="mb-0"> |
