diff options
| author | Patrick H. Lauke <[email protected]> | 2017-09-24 12:00:54 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-09-24 12:00:54 +0200 |
| commit | fd56ea370c371345cd9a34e65a615853ad882577 (patch) | |
| tree | 00b1785f0186f04172aa3a33978f9693a291bf2d /js/src | |
| parent | d33b26d8c7629e290b4ceca734a860793fd4c2b7 (diff) | |
| download | bootstrap-fd56ea370c371345cd9a34e65a615853ad882577.tar.xz bootstrap-fd56ea370c371345cd9a34e65a615853ad882577.zip | |
Accessibility fixes to dynamic tabs (`aria-selected`, remove dynamic tabs with dropdowns)
* Use `aria-selected` instead of `aria-expanded`
* Change tab.js to use `aria-selected` rather than `aria-expanded`
* Add `aria-orientation=vertical` to vertical tab list
* Remove dynamic tabs with dropdowns
* Fix non-interactive code examples
* Only set `aria-selected` on the `role="tab"` trigger - this stops `aria-selected` being incorrectly added to the `role="tabpanel"` itself (probably harmless, but nonetheless incorrect)
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/tab.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/js/src/tab.js b/js/src/tab.js index 18af4e7e2..2a554c287 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -196,11 +196,15 @@ const Tab = (() => { $(dropdownChild).removeClass(ClassName.ACTIVE) } - active.setAttribute('aria-expanded', false) + if (active.getAttribute('role') === 'tab') { + active.setAttribute('aria-selected', false) + } } $(element).addClass(ClassName.ACTIVE) - element.setAttribute('aria-expanded', true) + if (element.getAttribute('role') === 'tab') { + element.setAttribute('aria-selected', true) + } if (isTransitioning) { Util.reflow(element) |
