aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Bensch <[email protected]>2023-03-14 05:50:08 +0100
committerGitHub <[email protected]>2023-03-14 06:50:08 +0200
commite00d06e45bf0b15c018c3313fb129d938f56cb2b (patch)
tree420b7d56094fa0f7a4a4793c6370e0912108e805
parente9355c6dff78007e8d61d3ca62b768369a397f07 (diff)
downloadbootstrap-e00d06e45bf0b15c018c3313fb129d938f56cb2b.tar.xz
bootstrap-e00d06e45bf0b15c018c3313fb129d938f56cb2b.zip
Fix wrong generation of `aria-labelledby` in tab navigation (#38223)
* fix wrong generation of aria-labelledby in tab navigation * fix wrong test --------- Co-authored-by: Jan Bensch <[email protected]> Co-authored-by: XhmikosR <[email protected]>
-rw-r--r--js/src/tab.js2
-rw-r--r--js/tests/unit/tab.spec.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/js/src/tab.js b/js/src/tab.js
index cdba0e2e6..137cc0123 100644
--- a/js/src/tab.js
+++ b/js/src/tab.js
@@ -212,7 +212,7 @@ class Tab extends BaseComponent {
this._setAttributeIfNotExists(target, 'role', 'tabpanel')
if (child.id) {
- this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`)
+ this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`)
}
}
diff --git a/js/tests/unit/tab.spec.js b/js/tests/unit/tab.spec.js
index 1ac5929e1..95b31b4f0 100644
--- a/js/tests/unit/tab.spec.js
+++ b/js/tests/unit/tab.spec.js
@@ -514,7 +514,7 @@ describe('Tab', () => {
expect(tabPanel.hasAttribute('tabindex')).toBeFalse()
expect(tabPanel.hasAttribute('tabindex2')).toBeFalse()
- expect(tabPanel.getAttribute('aria-labelledby')).toEqual('#foo')
+ expect(tabPanel.getAttribute('aria-labelledby')).toEqual('foo')
expect(tabPanel2.hasAttribute('aria-labelledby')).toBeFalse()
})
})