Skip to content

Commit

Permalink
Fix wrong generation of aria-labelledby in tab navigation (#38223)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Mar 14, 2023
1 parent e9355c6 commit e00d06e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/src/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
}

Expand Down
2 changes: 1 addition & 1 deletion js/tests/unit/tab.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
})
Expand Down

0 comments on commit e00d06e

Please sign in to comment.