-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(MenuButton): match menu parent theme #19059
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
Conversation
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@IgnacioBecerra I think you need to run |
This appears to be working as intended, however I'm wondering if its needed if we are able to solve this bug around the focus and the |
@alisonjoseph The way I understand it, the And if we're not specifying the So I believe the focus "bug" isn't a bug per se, but rather we're using it incorrectly. I think it's meant to render in I'd like to hear the other devs' thoughts on this though! |
I think there's a bug with the focus behavior. Using the I wonder if the fix here is to delay CI for 42d2702 passed (see https://github.com/adamalston/carbon/actions/runs/14394192300/job/40366844549) and I can't reproduce #19076 in the test story in that commit. I suppose I could open a PR for that unless someone sees something inherently wrong with it or has other thoughts. I'll need to figure out a way to test it. Side note: the JSDoc comment for |
There's lots of issues related to this. #19076 that Alison mentioned, @2nikhiltom is working on #18997, and we've discussed the idea of removing portal usage from Menu in #16883 There's also been discussion in #18935 of a presence/visibility helper that maybe could be used to help with this situation as well? In any case I think it would be best if we could find another way to fix this without having to introduce this new prop to conditionally wrap it in a |
I feel removing the portal rendering and instead leveraging Floating UI for positioning in Menu would fix should fix majority of bugs like Focus Management, MenuTarget inconsistency and themes related issues. |
@tay1orjones @IgnacioBecerra I'm going to go ahead and close this, this isn't blocking anything for Platforms right now, I think fixing #18997 might solve the issue anyway. |
Closes carbon-design-system/carbon-labs#536
Closes carbon-design-system/carbon-labs#537
This PR introduces a new prop for
MenuButton
andMenu
calledmatchTheme
.In
@carbon-labs
, for the Default UI Shell story, upon opening theMenuButton
labeledSelect Category
, the focus is directed to the newMenu
itself rather than the firstMenuItem
.This is due to the Default story using
target={headerRef.current}
for theMenuButton
, referring to theHeaderContainer
housing the component. Removing it means the menu renders as the last element in thedocument.body
, fixing this focus issue, as seen in the Header story.However there is the side effect of the menu not rendering with the correct parent theme, as it's being render outside of its parent's theme scope. I'm not entirely sure why this fixes the focus error, but for the moment, this change allows for the menu to match its parent's theme.
Changelog
New
matchTheme
boolean prop toMenuButton
andMenu
Testing / Reviewing
Go to the new
With matched theme
story underMenuButton
, and the menu will display in it's parent's theme. Note that the button itself is still the default kind.