[menu] Unexpected behavior when pressing Shift + Tab in submenu
Bug report
Current behavior
This is subtle, but I believe there is a bug when using the keyboard to navigate a menu that contains a submenu: pressing Shift + Tab when the focus is on a subitem keeps the submenu open even though the focus returns to the root menu. Furthermore, when pressing Shift + Tab again to move the focus to the root menu's trigger and pressing Space to close the menu, the root menu runs its exit animation while closing, but the submenu disappears abruptly:
https://github.com/user-attachments/assets/6581d3f1-b2bc-4744-a096-76f126701568
Expected behavior
I would expect the first Shift + Tab to behave exactly like the left arrow key, closing the submenu:
https://github.com/user-attachments/assets/3f2d84c0-ac45-488a-bbf4-768e365cc253
Reproducible example
https://codesandbox.io/p/sandbox/nc65cv
Base UI version
1.0.0-alpha.8
Which browser are you using?
Chrome, Safari, and Firefox
Which OS are you using?
macOS
Which assistive tech are you using (if applicable)?
None