#is there any way to make solid router links apply on mousedown / touchstart instead of click?

7 messages · Page 1 of 1 (latest)

blazing lagoon
#

I dunno, I think that behavior would annoy me. I regularly press + hold and open in a new tab (on mobile)

#

But I think this is mainly a question of anchor tag behavior?

#

Aha

reef venture
#

I haven't tested this but straightforward shot in the dark. Couldn't you just add a listener for mousedown/touchstart and call element.click()?

#

I don't think it's possible. under the hood it renders a regular a element with an href. So it's the regular behavior of a regular anchor tag

#

Yeah I hadn't thought of that before. it's an interesting question. It does render an a tag, I don't know how the router achieves SPA routing. Magic stuff

#

https://github.com/solidjs/solid-router/blob/b2b13137710ef528919677e3465ca9f0cf68f87b/src/routing.ts#L444
Anchor clicks are intercepted. And yeah using navigate instead works, but then you wouldn't technically need an A tag to begin with. It could be any element

GitHub

A universal router for Solid inspired by Ember and React Router - solid-router/routing.ts at b2b13137710ef528919677e3465ca9f0cf68f87b · solidjs/solid-router