-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
enhanced ctrl + click new tab opening feature #1248
Conversation
Hey, thanks for creating this PR! I think the actual issue is with the Link.js component, not the sidebar. I suggest adding something to the onClick listener in that component that just returns if ctrl (or command in the case of mac) is held down |
Hey @timgl my bad didn't realize it could have been that minor change. |
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.
Almost there!
frontend/src/lib/components/Link.js
Outdated
@@ -7,6 +7,10 @@ export function Link({ to, preventClick = false, ...props }) { | |||
href={to || '#'} | |||
{...props} | |||
onClick={(event) => { | |||
if (event.ctrlKey) { |
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.
Could you do if (event.metaKey || event.ctrlKey)
so that it works on mac as well?
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.
sure will add it right away
frontend/src/lib/components/Link.js
Outdated
@@ -7,6 +7,10 @@ export function Link({ to, preventClick = false, ...props }) { | |||
href={to || '#'} | |||
{...props} | |||
onClick={(event) => { | |||
if (event.ctrlKey) { | |||
window.open(to, '_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.
Could you do return window.open(to, '_blank')
? Now if you open it in a new tab it'll also load the page in the current tab
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.
done 😄
Awesome, thanks! |
Changes
modified collapseSidebar function and added the url parameter so if any sidebar is being clicked the user would be ab
open a new tab upon have ctrl button pressed.
Not sure if any specific contributing guidelines are there do let me know incase I miss out anything.
Reference to issue #1187 , #850
code review: @timgl @mariusandra
checklist