File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export interface UseDropdownToggleProps {
10
10
id : string ;
11
11
ref : DropdownContextValue [ 'setToggle' ] ;
12
12
onClick : React . MouseEventHandler ;
13
- 'aria-expanded' : boolean ;
13
+ 'aria-expanded' ? : boolean | null ;
14
14
'aria-haspopup' ?: true ;
15
15
}
16
16
@@ -49,14 +49,16 @@ export function useDropdownToggle(): [
49
49
id,
50
50
ref : setToggle || noop ,
51
51
onClick : handleClick ,
52
- 'aria-expanded' : ! ! show ,
53
52
} ;
54
53
55
54
// This is maybe better down in an effect, but
56
55
// the component is going to update anyway when the menu element
57
56
// is set so might return new props.
58
57
if ( menuElement && isRoleMenu ( menuElement ) ) {
59
58
props [ 'aria-haspopup' ] = true ;
59
+ props [ 'aria-expanded' ] = show || null ;
60
+ } else {
61
+ props [ 'aria-expanded' ] = ! ! show ;
60
62
}
61
63
62
64
return [ props , { show, toggle } ] ;
You can’t perform that action at this time.
0 commit comments