Skip to content

Commit

Permalink
fix: filter block a11y (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
PahaN47 authored Sep 5, 2024
1 parent 4f124f4 commit 41b2bc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/components/ButtonTabs/ButtonTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ButtonTabs: React.FC<ButtonTabsProps> = ({
);

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

Expand All @@ -65,7 +65,8 @@ const ButtonTabs: React.FC<ButtonTabsProps> = ({
size={tabSize}
onClick={handleClick(id)}
extraProps={{
'aria-current': isActive || undefined,
role: 'tab',
'aria-selected': isActive,
}}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/ButtonTabs/__tests__/ButtonTabs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('ButtonTabs', () => {
test('has active tab', async () => {
const activeTabId = 1;
render(<ButtonTabs items={items} qa={qa} activeTab={String(activeTabId)} />);
const buttons = screen.getAllByRole('button');
const buttons = screen.getAllByRole('tab');

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

const buttons = screen.getAllByRole('button');
const buttons = screen.getAllByRole('tab');

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

0 comments on commit 41b2bc3

Please sign in to comment.