Skip to content

Commit debf477

Browse files
authored
feat: add aria-current for Tabs component (#520)
1 parent 7d7001b commit debf477

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

src/components/ButtonTabs/ButtonTabs.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,22 @@ const ButtonTabs: React.FC<ButtonTabsProps> = ({
5454

5555
return (
5656
<div className={b(null, className)} data-qa={qa}>
57-
{items.map(({id, title}) => (
58-
<Button
59-
text={title}
60-
className={b('item', {active: id === activeTabId})}
61-
key={title}
62-
size={tabSize}
63-
onClick={handleClick(id)}
64-
/>
65-
))}
57+
{items.map(({id, title}) => {
58+
const isActive = id === activeTabId;
59+
60+
return (
61+
<Button
62+
text={title}
63+
className={b('item', {active: isActive})}
64+
key={title}
65+
size={tabSize}
66+
onClick={handleClick(id)}
67+
extraProps={{
68+
'aria-current': isActive,
69+
}}
70+
/>
71+
);
72+
})}
6673
</div>
6774
);
6875
};

src/models/constructor-items/common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ export type ButtonTheme =
180180
| 'scale'
181181
| 'monochrome';
182182

183-
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width'> {
183+
export interface ButtonProps
184+
extends AnalyticsEventsBase,
185+
Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {
184186
text: string;
185187
url: string;
186188
primary?: boolean;

0 commit comments

Comments
 (0)