WICG / scroll-to-text-fragment

Proposal to allow specifying a text snippet in a URL fragment
Other
586 stars 43 forks source link

What happens when navigating from one text directive to another? #219

Closed bokand closed 1 year ago

bokand commented 1 year ago

Consider the user visits example.com#:~:text=foo. This site has a same-document link to #:~:text=bar.

I think in this case the highlight on foo should be removed. This is what Safari does. Chrome keeps the highlight on foo so that the page now highlights both foo and bar. I think the Safari behavior is more consistent; if the user now navigates to other.com and then does a back history navigation, the history entry has #:~:text=bar so only the second highlight would be restored.

The behavior should be explicit in the spec.

annevk commented 1 year ago

This might be the same issue as #217.

bokand commented 1 year ago

Yeah, I think settling the questions there will also resolve this so I'll close this one.