-
-
Notifications
You must be signed in to change notification settings - Fork 115
[Menubar] Create the Menubar component #1684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
const listNavigation = useListNavigation(floatingRootContext, { | ||
enabled: !disabled, | ||
listRef: itemDomElements, | ||
activeIndex, | ||
nested: false, | ||
loop, | ||
orientation, | ||
rtl: direction === 'rtl', | ||
onNavigate: (index) => { | ||
if (index !== null) { | ||
setActiveIndex(index); | ||
} | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice this has a lot of bugs, wouldn't it be better just to use Composite
? This is missing the hover functionality if a menu is already open, but it avoids many issues by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see if it's any better, thanks.
returnFocus={parent.type === undefined} | ||
initialFocus={parent.type === 'menu' ? -1 : 0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Playing with this, it doesn't seem to make sense not to return focus in a web context. Radix and Ariakit return focus to the trigger. In the OS, menubar has different accessibility semantics most likely regarding where focus is placed, but inside a browser the focus should be restored, otherwise it just restarts at the beginning of the document and loses the context
Bug:
|
This is by design to follow the pattern from MacOS menubar. |
Hmm, it feels off to me. It's another thing Radix & Ariakit do differently to this, possibly making it different in a web context cc: @colmtuite |
The Tailwind CSS demo has no transitions. I think it'd be best if the transitions matched macOS: no fade in transition, but a fade out transition (no scaling, though) |
On macOS, the open menu hides itself if you're still within the menubar bounds and not hovering over any trigger, but not if you go below the menubar in the "popups region" 🤔 |
👍 I updated the demos.
Right. I don't think it's strictly necessary to replicate this, though. |
Screencast.2025-04-23.14.15.17.mp4On Webstorm (Ubuntu), when I'm focusing an element in the menu and press "Escape", the focus moves back to the menu trigger. With the Base UI component, is it something we want to have? |
Bug with
|
Preview: https://deploy-preview-1684--base-ui.netlify.app/react/components/menubar
Experiment: https://deploy-preview-1684--base-ui.netlify.app/experiments/menubar
Closes #1407
To do
CompositeRoot
data-instant