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

Triggering onSelect for tree item middle click #2692

Merged
merged 2 commits into from Dec 15, 2022

Conversation

jdrush89
Copy link
Contributor

@jdrush89 jdrush89 commented Dec 14, 2022

Describe your changes here.

Triggering onSelect when middle click is pressed on a tree item. Users need to support the link shortcut of middle clicking to open in a new tab. onClick does not trigger an event for middle clicks, onAuxClick has to be used instead. Consumers can check the event.button when they get onSelect to handle opening the new tab. I could see an alternative solution being that the primer tree checks for ctrl/cmd + click and middle click and fires a different selection event for these cases. I'm happy to implement that if it seems like a better solution.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@jdrush89 jdrush89 requested review from a team and langermank December 14, 2022 21:47
@changeset-bot
Copy link

changeset-bot bot commented Dec 14, 2022

🦋 Changeset detected

Latest commit: 695801e

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 Patch

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

Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 Thanks for implementing this, @jdrush89 💖

@colebemis
Copy link
Contributor

I don't have a mouse with a middle button, so I'm going to trust that onAuxClick works as you described

@colebemis colebemis merged commit 5352bcc into primer:main Dec 15, 2022
@primer-css primer-css mentioned this pull request Dec 15, 2022
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.

None yet

2 participants