-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[ResourceList.Item] Add support for cmd / ctrl click #690
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
👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. You can also join #polaris on the Shopify Partners Slack. |
This isn't specifically relevant to this implementation, but why are we not just relying on native link behaviours here? |
Resource list items often contain links and buttons, so we have not implemented the item as a link as links can't contain other links. |
Didn't we used to have a version that overlayed a visually hidden |
We do something like this in the polaris rails implementation of resource list, but that's not without its problems (issues like highlighting and selecting text.) |
Eeeey it's that old trick. Leveraging native link behaviour is preferable to me, as this doesn't cover middle-click to open a new tab. |
ef6a998
to
347731b
Compare
} | ||
|
||
if (ctrlKey || metaKey) { | ||
return window.open(url, '_blank'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should do a check for url
because it's not required if there's an onClick.
Also I wonder, if there is an onClick and a URL should the this command click happen first and the onClick be ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured we should err on the side of caution here and allow the onClick to fire regardless.
We render a link if a URL is provided, put it behind the item content and call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update the case where's theres no url and update the unreleased.md. 🎩 looks good, thanks!
347731b
to
eb6576c
Compare
Thanks for the tophat and comments @dleroux. I've updated this PR |
eb6576c
to
13e9f58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
13e9f58
to
53ebee1
Compare
53ebee1
to
3302eb9
Compare
🎉 Thanks for your contribution to Polaris React! |
WHY are these changes introduced?
Resolves an issue outlined in a project I'm working now where users cannot command / control click to open up list items in new tabs.
This is useful for opening more than one item at a time.
WHAT is this pull request doing?
Fixes the above ☝️
🎩 checklist