diff options
author | Patrick H. Lauke <redux@splintered.co.uk> | 2017-09-24 13:00:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-24 13:00:54 +0300 |
commit | fd56ea370c371345cd9a34e65a615853ad882577 (patch) | |
tree | 00b1785f0186f04172aa3a33978f9693a291bf2d /js/src/tab.js | |
parent | d33b26d8c7629e290b4ceca734a860793fd4c2b7 (diff) |
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/tab.js')
-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 18af4e7e27..2a554c287d 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) |