File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export interface UseDropdownToggleProps {
1010 id : string ;
1111 ref : DropdownContextValue [ 'setToggle' ] ;
1212 onClick : React . MouseEventHandler ;
13- 'aria-expanded' : boolean ;
13+ 'aria-expanded' ? : boolean | null ;
1414 'aria-haspopup' ?: true ;
1515}
1616
@@ -49,14 +49,16 @@ export function useDropdownToggle(): [
4949 id,
5050 ref : setToggle || noop ,
5151 onClick : handleClick ,
52- 'aria-expanded' : ! ! show ,
5352 } ;
5453
5554 // This is maybe better down in an effect, but
5655 // the component is going to update anyway when the menu element
5756 // is set so might return new props.
5857 if ( menuElement && isRoleMenu ( menuElement ) ) {
5958 props [ 'aria-haspopup' ] = true ;
59+ props [ 'aria-expanded' ] = show || null ;
60+ } else {
61+ props [ 'aria-expanded' ] = ! ! show ;
6062 }
6163
6264 return [ props , { show, toggle } ] ;
You can’t perform that action at this time.
0 commit comments