HTML Text Fragments
First, to be clear on terminology. By "Text Fragments" I mean linking to a specific portion of a page. See: https://developer.mozilla.org/en-US/docs/Web/Text_fragments This is sometimes called "Anchoring." But that usually refers to something a little different. You can see this in action by going to the docoumentation and clicking on headers to see how it scrolls you to that specific section and adds the hash to the URL
I didn't see any documentation about supporting this. Of course by support i mean just adding the #. The actual scrolling portion is handled by the browser. Should this sort of thing be managed outside of the tanstack API using normal
window.location.hash / <a href="#myAnchor'>? The problem with this being that tanstack won't manage the hash properly so I have to deal with programatically clearing the hash when I go somewhere else...
target seems to always open a new tab, which isn't really desirable. to will add a / and type safety will complain about it not knowing the #route. href is a prop, but seem to be ignored entirely and whatever I put is just replaced with my current route
in react-router-dom this would be done by just doing useNavigate() and navigate("#myAnchor"). When you navigate ed somewhere else the hash would be cleared.
Any ideas?MDN Web Docs
Text fragments | MDN
Text fragments allow linking directly to a specific portion of text in a web document, without requiring the author to annotate it with an ID, using particular syntax in the URL fragment. Supporting browsers are free to choose how to draw attention to the linked text, e.g. with a color highlight and/or scrolling to the content on the page. This ...
0 Replies