File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -94,10 +94,12 @@ const MenubarTrigger = React.forwardRef<HTMLButtonElement, MenubarTriggerProps>(
9494 const { id, title, first, last } = useContext ( SubmenuContext ) ;
9595 const { isOpen, handlers } = useMenuProps ( id ) ;
9696
97+ const buttonRef = ref as React . RefObject < HTMLButtonElement > ;
98+
9799 const handleMouseEnter = ( e : React . MouseEvent ) => {
98100 if ( hasFocus ) {
99101 const items = Array . from ( menuItems ) ;
100- const index = items . findIndex ( ( item ) => item === ref . current ) ;
102+ const index = items . findIndex ( ( item ) => item === buttonRef . current ) ;
101103
102104 if ( index !== - 1 ) {
103105 setActiveIndex ( index ) ;
@@ -204,6 +206,14 @@ function MenubarList({
204206 * MenubarSubmenu
205207 * -----------------------------------------------------------------------------------------------*/
206208
209+ export interface MenubarSubmenuProps {
210+ id : string ;
211+ children ?: React . ReactNode ;
212+ title : string ;
213+ triggerRole ?: string ;
214+ listRole ?: MenubarListItemRole ;
215+ }
216+
207217/**
208218 * MenubarSubmenu manages a triggerable submenu within a menubar. It is a compound component
209219 * that manages the state of the submenu and its items. It also provides keyboard navigation
@@ -225,15 +235,6 @@ function MenubarList({
225235 * </MenubarSubmenu>
226236 * </Menubar>
227237 */
228-
229- export interface MenubarSubmenuProps {
230- id : string ;
231- children ?: React . ReactNode ;
232- title : string ;
233- triggerRole ?: string ;
234- listRole ?: MenubarListItemRole ;
235- }
236-
237238export function MenubarSubmenu ( {
238239 children,
239240 id,
You can’t perform that action at this time.
0 commit comments