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.
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 onfoo
so that the page now highlights bothfoo
andbar
. I think the Safari behavior is more consistent; if the user now navigates toother.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.