-
Notifications
You must be signed in to change notification settings - Fork 113
fix(topstories): Ctrl-click/middle mouse button does not open new tab #3046
Conversation
this.props.dispatch(ac.SendToMain({type: at.OPEN_LINK, data: this.props.link})); | ||
this.props.dispatch(ac.SendToMain({ | ||
type: at.OPEN_LINK, | ||
data: Object.assign(this.props.link, {where: (event.ctrlKey || event.metaKey || event.button === 1) ? "tab" : "current"}) |
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.
So this supports "tab" but not the other click behaviors, e.g., "window" (on shift) and "save" (on alt) or other behaviors supported in whereToOpenLink
:
https://searchfox.org/mozilla-central/source/browser/base/content/utilityOverlay.js#111-159
Not sure if there's a good way to just send the event over to call that method on the browser.
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.
Yeah, I didn't find one :(. We have support for "window" though via the context menu (not shortcut) (incl. private windows).
I think this is better than not having it for 56, but I will leave it up to you guys. I am fine either way and can dig in more.
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.
Looks like you could callbrowser.ownerGlobal.whereToOpenLink
with the event, if you can pass the whole event up
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.
A fake event
should work to get across the message boundary:
const {altKey, button, ctrlKey, metaKey, shiftKey} = event;
dispatch({…
data: … {event: {altKey, button, ctrlKey, metaKey, shiftKey}, …}
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.
@Mardak ah I will try that. Was just looking for ways to get the event across again.
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.
If you can get this to work with whereToOpenLink
that seems like it would be ideal. Otherwise, this is probably good enough for 56
this.props.dispatch(ac.SendToMain({type: at.OPEN_LINK, data: this.props.link})); | ||
this.props.dispatch(ac.SendToMain({ | ||
type: at.OPEN_LINK, | ||
data: Object.assign(this.props.link, {where: (event.ctrlKey || event.metaKey || event.button === 1) ? "tab" : "current"}) |
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.
Looks like you could callbrowser.ownerGlobal.whereToOpenLink
with the event, if you can pass the whole event up
OK, I can give it another try. |
@Mardak @k88hudson thanks, updated. |
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.
nice. I just tested with shift-cmd-click!
Fixes #3033.