Skip to content

Expose closeOnSelect prop #8315

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sfc-gh-alisowski
Copy link

@sfc-gh-alisowski sfc-gh-alisowski commented May 28, 2025

Closes #8208

I noticed the hooks supports this but the component doesn't expose the type. It currently works cause of how the props are passed through.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

No tests needed

🧢 Your Project:

@snowystinger
Copy link
Member

Thanks for the PR!

It looks like in React Spectrum, we exposed it on the MenuTrigger https://react-spectrum.adobe.com/react-spectrum/Menu.html#menu

I think we'll want to discuss aggregate places to put this behaviour so it isn't required on every MenuItem and you aren't as likely to end up with differences within the same menu accidentally.

Maybe on Menu and MenuSection instead would be better. Will bring up with the team.

@sfc-gh-alisowski
Copy link
Author

In all the cases in our codebase the prop wouldn't really make sense in an aggregate place. We could work around that with that probably but would be nice if it were just exposed on the option

@snowystinger
Copy link
Member

We had a chance to talk about this today. We want to support this in Menu, MenuSection, and MenuItem.
We'd also like to rename the prop for the React Aria Components from closeOnSelect to shouldCloseOnSelect to match DatePicker
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RAC] MenuItem should support closeOnSelect boolean for when pressed/selected
2 participants