-
Notifications
You must be signed in to change notification settings - Fork 601
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
Use Floating UI for MenuItem submenus #6457
Conversation
<span | ||
?hidden="${x => !x.expanded}" | ||
class="submenu-container" | ||
part="submenu-container" | ||
${ref("submenuContainer")} | ||
> |
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.
Can we dig in here on the value of an internal element like this?
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.
Since the only thing we can confirm about the submenu is that it's an element with a role
of menu
, I think it's safer and less obtrusive to handle the positioning in the menu-item's shadow rather than on the slotted submenu element itself.
Here are some alternatives:
- Setting the positioning styles with the
style
attribute on the slotted submenu can cause conflicts with specificity and author intent. - Attaching a stylesheet to the nested element would address the specificity problem, but it would only be possible if the submenu is guaranteed to have a FAST controller (
$fastController
) to attach the styles.
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 agree this is probably a preferred API, though I'm certainly curious of others thoughts. Ideally we can document the intent as part of the readme, or somewhere else to help convey this. I think given the alternatives, this is the best method of providing positioning without needing to get prescriptive with whats slotted in.
b3e6aa6
to
027cb4a
Compare
18fd8d6
to
d7904d3
Compare
d7904d3
to
67191c9
Compare
67191c9
to
9511d06
Compare
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 like it.
9511d06
to
4582740
Compare
Thanks @radium-v! |
* use floating-ui for menu-item submenus * Change files
Pull Request
📖 Description
Replaces the methods used to position submenus for menu-item with Floating UI.
Changes the
updateSubmenu
method to be public to allow for overriding the default positioning behavior.🎫 Issues
👩💻 Reviewer Notes
📑 Test Plan
All tests for the menu-item and menu components should pass as expected.
✅ Checklist
General
$ yarn change
Component-specific
⏭ Next Steps