pateketrueke/yrv

How to ignore <a> fragments?

tyteen4a03 opened this issue · 7 comments

How do I instruct yrv to ignore anchor fragments?

I don't get you, can you provide an example? Thank you!

<a id="top"> and clicking on <a href="#top"> does not work since yrv takes over trying to route it when it should be going to the #top.

Oh gotcha! Do you think is fine to ignore all anchors except those starting with #/ instead? 🤔

Maybe have it configurable so that when using the history API it ignores all fragments.

I don't plan on using hash and not allowing / is technically breaking the rules but eh.

Any progress on this issue? :)

Hi, the only way I found to detect these kind of events is through e.isTrusted — so, when true seems to be from regular anchor elements.

Otherwise I'm not able to found a way to differentiate because e does not include the element that originated the navigation change.

Update: seems like the same event is fired whenever the user clicks on back/fwd buttons, so is not suitable the isTrusted way — do you have in mind a way to differentiate between anchors and router links?

What do you think?

I think a new issue would fit better, if I understood, we could add a particular attribute on those links we want to ignore, right?