Skip to content

Commit 41b2bc3

Browse files
authored
fix: filter block a11y (#980)
1 parent 4f124f4 commit 41b2bc3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/components/ButtonTabs/ButtonTabs.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const ButtonTabs: React.FC<ButtonTabsProps> = ({
5353
);
5454

5555
return (
56-
<div className={b(null, className)} data-qa={qa}>
56+
<div className={b(null, className)} role="tablist" data-qa={qa}>
5757
{items.map(({id, title}) => {
5858
const isActive = id === activeTabId;
5959

@@ -65,7 +65,8 @@ const ButtonTabs: React.FC<ButtonTabsProps> = ({
6565
size={tabSize}
6666
onClick={handleClick(id)}
6767
extraProps={{
68-
'aria-current': isActive || undefined,
68+
role: 'tab',
69+
'aria-selected': isActive,
6970
}}
7071
/>
7172
);

src/components/ButtonTabs/__tests__/ButtonTabs.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('ButtonTabs', () => {
3636
test('has active tab', async () => {
3737
const activeTabId = 1;
3838
render(<ButtonTabs items={items} qa={qa} activeTab={String(activeTabId)} />);
39-
const buttons = screen.getAllByRole('button');
39+
const buttons = screen.getAllByRole('tab');
4040

4141
buttons.forEach((button, index) => {
4242
if (index === activeTabId) {
@@ -59,7 +59,7 @@ describe('ButtonTabs', () => {
5959
const handleOnClick = jest.fn();
6060
render(<ButtonTabs items={items} qa={qa} onSelectTab={handleOnClick} />);
6161

62-
const buttons = screen.getAllByRole('button');
62+
const buttons = screen.getAllByRole('tab');
6363

6464
buttons.forEach(async (button, i) => {
6565
await user.click(button);

0 commit comments

Comments
 (0)