From: Jan Bensch <53659806+janbensch@users.noreply.github.com> Date: Tue, 14 Mar 2023 04:50:08 +0000 (+0100) Subject: Fix wrong generation of `aria-labelledby` in tab navigation (#38223) X-Git-Tag: v5.3.0-alpha2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e00d06e45bf0b15c018c3313fb129d938f56cb2b;p=thirdparty%2Fbootstrap.git 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 Co-authored-by: XhmikosR --- diff --git a/js/src/tab.js b/js/src/tab.js index cdba0e2e6a..137cc0123b 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 1ac5929e17..95b31b4f05 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() }) })