File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
src/components/ButtonTabs Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ const ButtonTabs: React.FC<ButtonTabsProps> = ({
53
53
) ;
54
54
55
55
return (
56
- < div className = { b ( null , className ) } data-qa = { qa } >
56
+ < div className = { b ( null , className ) } role = "tablist" data-qa = { qa } >
57
57
{ items . map ( ( { id, title} ) => {
58
58
const isActive = id === activeTabId ;
59
59
@@ -65,7 +65,8 @@ const ButtonTabs: React.FC<ButtonTabsProps> = ({
65
65
size = { tabSize }
66
66
onClick = { handleClick ( id ) }
67
67
extraProps = { {
68
- 'aria-current' : isActive || undefined ,
68
+ role : 'tab' ,
69
+ 'aria-selected' : isActive ,
69
70
} }
70
71
/>
71
72
) ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ describe('ButtonTabs', () => {
36
36
test ( 'has active tab' , async ( ) => {
37
37
const activeTabId = 1 ;
38
38
render ( < ButtonTabs items = { items } qa = { qa } activeTab = { String ( activeTabId ) } /> ) ;
39
- const buttons = screen . getAllByRole ( 'button ' ) ;
39
+ const buttons = screen . getAllByRole ( 'tab ' ) ;
40
40
41
41
buttons . forEach ( ( button , index ) => {
42
42
if ( index === activeTabId ) {
@@ -59,7 +59,7 @@ describe('ButtonTabs', () => {
59
59
const handleOnClick = jest . fn ( ) ;
60
60
render ( < ButtonTabs items = { items } qa = { qa } onSelectTab = { handleOnClick } /> ) ;
61
61
62
- const buttons = screen . getAllByRole ( 'button ' ) ;
62
+ const buttons = screen . getAllByRole ( 'tab ' ) ;
63
63
64
64
buttons . forEach ( async ( button , i ) => {
65
65
await user . click ( button ) ;
You can’t perform that action at this time.
0 commit comments