1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-25 12:59:05 +02:00

Tabs plugin accessibility

Added support for `aria-expanded` toggling via JavaScript. Added
`aria-controls`, `aria-expanded`, `aria-labelledby` to tabs docs.

Added `aria-expanded` unit test for the tabs plugin.

See also #13554.

Closes #14154 by merging it.
This commit is contained in:
Cameron Little
2014-09-09 18:17:56 +02:00
committed by Heinrich Fenkart
parent 38217ee405
commit 0755d529c6
3 changed files with 48 additions and 13 deletions

View File

@@ -71,9 +71,15 @@
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
element.addClass('active')
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
if (transition) {
element[0].offsetWidth // reflow for transition
@@ -83,7 +89,12 @@
}
if (element.parent('.dropdown-menu')) {
element.closest('li.dropdown').addClass('active')
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback && callback()