]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fix wrong generation of `aria-labelledby` in tab navigation (#38223)
authorJan Bensch <53659806+janbensch@users.noreply.github.com>
Tue, 14 Mar 2023 04:50:08 +0000 (05:50 +0100)
committerGitHub <noreply@github.com>
Tue, 14 Mar 2023 04:50:08 +0000 (06:50 +0200)
* fix wrong generation of aria-labelledby in tab navigation

* fix wrong test

---------

Co-authored-by: Jan Bensch <github@bensch.dev>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
js/src/tab.js
js/tests/unit/tab.spec.js

index cdba0e2e6aadd26cc89aa5095d8cb6a57fd7bf47..137cc0123b64fa532cb0fa1fcdd36145e2787138 100644 (file)
@@ -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}`)
     }
   }
 
index 1ac5929e178bde883a42a7582fca7356ee4134e6..95b31b4f05438c70192f01ca4f90456147cd2ce9 100644 (file)
@@ -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()
     })
   })