GoogleChromeLabs / link-to-text-fragment

Browser extension that allows for linking to arbitrary text fragments.
https://chrome.google.com/webstore/detail/link-to-text-fragment/pbcodcjpfjdpcineamnnmbkkmkdpajjg
Apache License 2.0
412 stars 33 forks source link

Scroll to text fails for fragments that include hyphenated words #80

Closed jimmoffet closed 1 year ago

jimmoffet commented 1 year ago

Chrome 109.0.5414.87 (Official Build) (arm64)

Succeeds: Highlighted text: the user is made aware of the text match, such as with a https://wicg.github.io/scroll-to-text-fragment/#:~:text=the%20user%20is%20made%20aware%20of%20the%20text%20match%2C%20such%20as%20with%20a

Fails: Highlighted text: the user is made aware of the text match, such as with a high-contrast highlight https://wicg.github.io/scroll-to-text-fragment/#:~:text=the%20user%20is%20made%20aware%20of%20the%20text%20match%2C%20such%20as%20with%20a%20high-contrast%20highlight

Seems like a bug in extension implementation, not in the text fragments implementation. EDIT: I guess this is a matter of perspective, in any case, substituting %2D for the hyphen in the appropriate location(s) solves the problem.

Succeeds: Highlighted text: the user is made aware of the text match, such as with a high-contrast highlight https://wicg.github.io/scroll-to-text-fragment/#:~:text=the%20user%20is%20made%20aware%20of%20the%20text%20match%2C%20such%20as%20with%20a%20high%2Dcontrast%20highlight

jimmoffet commented 1 year ago

Just submitted a fix in #81 (waiting for the newly-submitted CLA to be acknowledged)

tomayac commented 1 year ago

Thanks for the contribution. If this is a problem, it should be fixed at the source. Could you please see https://github.com/GoogleChromeLabs/text-fragments-polyfill/issues. Also note that there might be edge cases where a simple replacement won’t work. I’m closing the Issue here.