File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,15 @@ describe('Alert Component', () => {
160
160
await expect ( container ) . toValidateA11y ( ) ;
161
161
} ) ;
162
162
163
+ describe ( 'a11y' , ( ) => {
164
+ it ( 'has role group on the element referenced by the focus ref' , ( ) => {
165
+ let ref : AlertProps . Ref | null = null ;
166
+ render ( < Alert header = "Important" ref = { element => ( ref = element ) } /> ) ;
167
+ ref ! . focus ( ) ;
168
+ expect ( document . activeElement ) . toHaveAttribute ( 'role' , 'group' ) ;
169
+ } ) ;
170
+ } ) ;
171
+
163
172
describe ( 'analytics' , ( ) => {
164
173
test ( `adds ${ DATA_ATTR_ANALYTICS_ALERT } attribute with the alert type` , ( ) => {
165
174
const { container } = renderAlert ( {
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ const InternalAlert = React.forwardRef(
134
134
) }
135
135
>
136
136
< div className = { styles [ 'alert-wrapper' ] } >
137
- < div className = { styles [ 'alert-focus-wrapper' ] } tabIndex = { - 1 } ref = { focusRef } >
137
+ < div className = { styles [ 'alert-focus-wrapper' ] } tabIndex = { - 1 } ref = { focusRef } role = "group" >
138
138
< div className = { clsx ( styles . icon , styles . text ) } >
139
139
< InternalIcon name = { typeToIcon [ type ] } size = { size } ariaLabel = { statusIconAriaLabel } />
140
140
</ div >
You can’t perform that action at this time.
0 commit comments