Skip to content
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

ActionList.Item: Check defaultPrevented between onSelect & afterSelect #3314

Closed
wants to merge 4 commits into from

Conversation

siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented May 23, 2023


Context: Today, if you want to customize the behaviour of a menu after selection (like in the video below) you have to opt out of onSelect and implement it yourself using onClick and onKeypress

As you can imagine, this can create bugs if not done well. This PR adds the ability to prevent the default behavior after onSelect by calling event.preventDefault inside it. (See newly added story for example)

delay-actionmenu-afterselect.mov

@changeset-bot
Copy link

changeset-bot bot commented May 23, 2023

🦋 Changeset detected

Latest commit: 85baf9f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented May 23, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 116.18 KB (+0.01% 🔺)
dist/browser.umd.js 118.04 KB (+0.01% 🔺)

@siddharthkp siddharthkp marked this pull request as ready for review May 23, 2023 14:44
@siddharthkp siddharthkp requested review from a team and joshblack May 23, 2023 14:44
@siddharthkp siddharthkp added 💓collab a vibrant hub of collaboration react labels May 23, 2023
@siddharthkp siddharthkp temporarily deployed to github-pages May 23, 2023 14:47 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3314 May 23, 2023 14:47 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3314 May 23, 2023 14:48 Inactive
@siddharthkp
Copy link
Member Author

Don't need this anymore. Fixed in #3346

@siddharthkp siddharthkp deleted the actionlist-check-event branch December 7, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💓collab a vibrant hub of collaboration react
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<ActionList.Item>: event in onClick can be canceled, but it cannot be canceled in onSelect
2 participants