rturnq / solid-router

A router for solid-js
MIT License
42 stars 1 forks source link

opening hash link in new tab is broken #13

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi, first thanks for the library. I have a problem with hash router. Clicking this element with middle mouse button

<Link class="btn btn-link ml-2" href="/monitor">
  Monitor
</Link>

which normally leads to: http://localhost:8080/web-app#/monitor opens a new tab with this address: http://localhost:8080/monitor. I would expect it to open a new tab with http://localhost:8080/web-app#/monitor. I tried both hashIntegration and history integration with createHashHistory but both behave this way. Is this a bug or how can I fix this?

ghost commented 3 years ago

looks like inferno router ignores middle clicks: code. also same with react router: code. should this be the default or is it possible to make it work like a normal link maybe?

ghost commented 3 years ago

I think this just needs a makeHref function that will be used by to put hrefs into elements instead of just using href prop

rturnq commented 3 years ago

Sorry for the slow reply. Yeah, I didn't consider that some integrations would need the href to be rendered differently in the link. The links should absolutely works as normal links, so I'll need to fix this and probably look at the target attribute as well. I guess this means the integration needs to be a little more than just a signal.

rturnq commented 3 years ago

Ok, check out v0.2.1. I added overridable path rendering and the onclick ignore logic from React Router. You shouldn't have to make any changes to your code.

ghost commented 3 years ago

thank you, it works now.