3 ms·
At this point I wonder if browsers couldn't be adjusted to this, and have link behavior on any element that indirectly behaves like a link. For instance if a u
by makeitdouble 3y ago
At this point I wonder if browsers couldn't be adjusted to this, and have link behavior on any element that indirectly behaves like a link.
For instance if a user ctr + cliks a button, have the navigation happen in a tab window even if the URL change is pushed by a JS module down the line.
- paulddraper 3y ago? You need a href for the browser to know where to navigate to. Just use RouterLink. It uses a native anchor tag. If you click (without Ctrl/cmd) it prevents default and does the navigation without reload.
- jakelazaroff 3y agoWhat is RouterLink? A quick Google search turns up some Angular thing, but I don’t think anyone was talking specifically about Angular.
- whstl 3y agoGP is talking about the component/feature present in React/Vue/Angular/etc routers that allows links to behave like normal anchor links (allowing to open in another window, etc) but also use the SPA router for navigation when possible. I'm not making any argument here, just explaining. Also makeitdouble's idea would apply even to non-SPAs or to pages without javascript. For example, I might want to submit a form but in a new tab.
- paulddraper 3y agoSorry, RouterLink for Angular, NavLink for React router.
- matheusmoreira 3y agoWould be better if browsers adjusted so as to deliberately break React and its brethren instead instead of fixing the mess they made. The web used to work great, now look at what it's become. People can't even put a link in the document properly.