Skip to content

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

Closed
siddharthkp wants to merge 4 commits into
mainfrom
actionlist-check-event
Closed

ActionList.Item: Check defaultPrevented between onSelect & afterSelect#3314
siddharthkp wants to merge 4 commits into
mainfrom
actionlist-check-event

Conversation

@siddharthkp

@siddharthkpsiddharthkp commented May 23, 2023

Copy link
Copy Markdown
Member

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

changeset-botBot commented May 23, 2023

Copy link
Copy Markdown

🦋 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
NameType
@primer/reactMinor

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

github-actionsBot commented May 23, 2023

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js116.18 KB (+0.01% 🔺)
dist/browser.umd.js118.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 joshblackMay 23, 2023 14:44
@siddharthkpsiddharthkp 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-actionsBot temporarily deployed to storybook-preview-3314 May 23, 2023 14:47 Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3314 May 23, 2023 14:48 Inactive
@siddharthkp

Copy link
Copy Markdown
MemberAuthor

Don't need this anymore. Fixed in #3346

@siddharthkp
siddharthkp deleted the actionlist-check-event branch December 7, 2023 13:31
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💓collaba vibrant hub of collaborationreact

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

@siddharthkp@joshblack