Closed moetelo closed 1 year ago
My guess is that the polyfill should match Chrome's behavior, so the PR is here: https://github.com/GoogleChromeLabs/text-fragments-polyfill/pull/137.
I noticed this as well in Firefox by just changing the #:~:text=
in the URL bar and pressing Enter. Chrome (tested 108) highlights and scrolls to the new text, while the polyfill does not.
@bokand, what do you think is the right behavior here?
There's some context in https://github.com/WICG/scroll-to-text-fragment/issues/74
Given the way STTF is spec'd and implemented, a hash change should cause a scroll-to-text since it invokes the "scroll to the fragment" algorithm which is where STTF is invoked.
Thanks, @bokand! So @tfmar, are you happy to merge #137?
Any reason why this is not merged yet?
@bokand @tfmar is anyone from the team owning this?
Apologies for the delay - looks good with a comment I left on the review.
@bokand Can't find your comment. Could you request changes directly on the PR, if there are any issues?
Sorry - I forgot to hit "submit". You should see it now
In Chrome, if you set a new text fragment hash programmatically, like https://github.com/GoogleChromeLabs/text-fragments-polyfill
location.hash = '#:~:text=module%20of%20util-,functions,-for%20generating%20URLs';
, the page will be scrolled to the text.The behavior does not provide such functionality.