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:
committed by
Heinrich Fenkart
parent
38217ee405
commit
0755d529c6
17
js/tab.js
17
js/tab.js
@@ -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()
|
||||
|
Reference in New Issue
Block a user