Ignore links
See original GitHub issueI’m trying to use a third party library with choo. I’ve actually done it before with choo v3, and now I’m passing it to choo v6. Now this library defines image links like this:
<a href="/link/to/image.jpg">
<img src="/link/to/image.jpg"/>
</a>
So, my problem is that choo try to handle the image route and throws route not found
.
Now, in choo docs it says that links are ignored when:
- the click event had .preventDefault() called on it
- the link has a target=“_blank” attribute with rel=“noopener noreferrer”
- a modifier key is enabled (e.g. ctrl, alt, shift or meta)
- the link’s href starts with protocol handler such as mailto: or dat:
- the link points to a different host
- the link has a download attribute
So, my question is is there an easier way to ignore links? without having to use preventDefault and programatic navigation? I remember that before there was a noroute
data attribute or similar (maybe in sheet-router times?) is there still something like that?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
How to Disable Links | CSS-Tricks
There is a problem though: there is no real way to disable an <a> link (with a valid href attribute) in HTML. Not...
Read more >Accessibility Skip links - W3Schools
The most common skip link is the first interactive element on a page. It takes the user to the main content, past the...
Read more >Disavow links to your site - Search Console Help
If you can't remove those links yourself, or get them removed, then you should disavow the URLs of the questionable pages or domains...
Read more >Disable links.
Hold Ctrl+Alt to disable the links temporarily. This extension is deprecated - Chrome has a built-in feature for this, just holding Alt ...
Read more >Skip Navigation Links - WebAIM
Visible skip links ... The easiest method of creating a skip navigation link is to put it at or near the top of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Glad to hear. If you don’t want to fiddle with the source of nanohref, you could just extend choo with this functionality.
Oh right, i see what you’re doing. What you’re doing is a bit of an edge case, as you’re linking to a route on the same host that the router is not supposed to handle.
Ideally in cases like these the image would be served from a different host, which allows it to continue as intended.
Perhaps you could instead define a view that all it does is render the image? Or perhaps a view that all it does is redirect to the requested resource?
Not sure if any of these cut it tho; maybe you’re right and we should indeed allow for a custom way to flag a link that it shouldn’t be handled. But could you perhaps give any of the above a shot before we get into how these could be handled? Thanks!
On Tue, Aug 15, 2017, 11:11 Brecht Savelkoul notifications@github.com wrote: