0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-17 14:54:30 +01:00

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 <github@bensch.dev>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
Jan Bensch 2023-03-14 05:50:08 +01:00 committed by GitHub
parent e9355c6dff
commit e00d06e45b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View 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}`)
}
}

View 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()
})
})