I have FlowRouter for my Meteor’s routing. And I use React.
I will going crazy with my bug.
I have a simple component with a link balise :
<a href="/somePath" onClick={this.onClick.bind(this)} key={artwork._id}> Link </a>
And my onClick function is :
onClick(e){
e.preventDefault();
}
It’s very basic… so I want to prevent the click on the link… a very common feature.
BUT it doesn’t work !
On the left click, FlowRouter go the /somePath route. On the middle click, the preventDefault() works.
On the right click, the link is open in the new tab.
I don’t want the left click to go to the route, I want to open a modal with some content. And I want to have the right click which open the link on the new tab.
This has been previously discussed in a few places:
This is an issue with Flow Router (or more specifically Page.js which it uses behind the scenes). You might want to consider removing the href from your link, and handling your routing call via your onClick handler. Another option is to consider switching to React Router (where this does work properly).
When you click on a design, a modal with the content of the design is contened.
The url change but the user stay on the same page.
When you right click on a design, and your open a new tab, you are redirect to the single page of this design.
All of this are handle in my application. But only the left click doesn’t work like i said before.
For the moment, my href is ‘/’ to stay on the home page and show modal. But with right click, user is redirected to the home page, and not to the single page…