Closed vvhsk closed 6 years ago
Ctrl or Cmd + click on an hyperlink opens a new tab, so it's not something your router can do (and should do) something about.
@troch I just wanted to quickly comment that I was looking for more information about this as well. Thanks in advance for the library and your support :)
If I use cmd+click
in the redux demo it does not open in a new window as I would have expected.
I was looking through the code, and if I understand correctly, the ability to open in a new window with ctrl+cmd
is predicated on your using a component for links that inherits from <BaseLink>
(react) which handles the click event and checks for keys pressed. So if you are using the redux router without react (let's say polymer+redux or lit-html+redux) it looks like a custom element would be required to implement the same sort of on-click handling. Is my understanding correct?
Oh I see, it is because .preventDefault
is called, and there is no check for combo keys being pressed.
@troch
Thanks, I understood this later after created the issue, I made this behaviour with custom handler. I had little misunderstanding that only <BaseLink>
can handle key pressed in redux demo (as @bradrydzewski described). Maybe this should be documented somewhere?
I think that's because the examples have not been updated for a while, but links have been checking for ctrl / meta / alt keys for a while now (https://github.com/router5/router5/blob/master/packages/react-router5/modules/BaseLink.js#L58-L61).
Hi to all.
Is there any default method to open navigate (navigateTo) links in new tab when pressing ctrl, cmd or meta key?