Skip to content

Commit

Permalink
refactor(tabs): resilience for tab ID values
Browse files Browse the repository at this point in the history
We need to ensure that tabs only includes a valid tab value, whereas the current implementation might start with e.g. a number.
  • Loading branch information
mfranzke authored Nov 28, 2024
1 parent 63391df commit c22c8ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/components/src/components/tabs/tabs.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function DBTabs(props: DBTabsProps) {

if (input && label) {
if (!input.id) {
const tabId = `${state._name}-tab-${index}`;
const tabId = `tabs-${state._name}-tab-${index}`;
label.setAttribute('for', tabId);
input.setAttribute(
'aria-controls',
Expand Down Expand Up @@ -128,7 +128,7 @@ export default function DBTabs(props: DBTabsProps) {
panel.id = `${state._name}-tab-panel-${index}`;
panel.setAttribute(
'aria-labelledby',
`${state._name}-tab-${index}`
`tabs-${state._name}-tab-${index}`
);
}
}
Expand Down

0 comments on commit c22c8ce

Please sign in to comment.