ichaoX / ext-textFragment

Firefox Text Fragment Extension
https://addons.mozilla.org/en-US/firefox/addon/text-fragment/
GNU General Public License v3.0
12 stars 0 forks source link

Strips fragment from parent document after generating link from content in `iframe`. #14

Open RokeJulianLockhart opened 1 week ago

RokeJulianLockhart commented 1 week ago

Errata

  1. Example

    Original https://mail.proton.me/u/6/almost-all-mail/2pmw0JglyiQHpIMGgvn05Pq4SoTeUMiMooISZDWRNp3KClTVevNTGlzOVgGeUWfxd8cCW_Qo1MxhRI97JtEPpA==/l-IcfP9WeRPXRO8VySNI7zgeN0V-E1nWb4UtTDXP5xHgWwd8KUzUIWn_ote-ga5wyZzU8JjPealLpJCO1jPS-w==#keyword=Mobile+Firefox%3A+Other&begin=1731369600&end=1731628800&from=w0q9hlr8%40rokejulianlockhart.addy.io
    Result https://mail.proton.me/u/6/almost-all-mail/2pmw0JglyiQHpIMGgvn05Pq4SoTeUMiMooISZDWRNp3KClTVevNTGlzOVgGeUWfxd8cCW_Qo1MxhRI97JtEPpA==/l-IcfP9WeRPXRO8VySNI7zgeN0V-E1nWb4UtTDXP5xHgWwd8KUzUIWn_ote-ga5wyZzU8JjPealLpJCO1jPS-w==#:~:text=Your%20request%20(-,3233006,-)%20has%20been
    Expected https://mail.proton.me/u/6/almost-all-mail/2pmw0JglyiQHpIMGgvn05Pq4SoTeUMiMooISZDWRNp3KClTVevNTGlzOVgGeUWfxd8cCW_Qo1MxhRI97JtEPpA==/l-IcfP9WeRPXRO8VySNI7zgeN0V-E1nWb4UtTDXP5xHgWwd8KUzUIWn_ote-ga5wyZzU8JjPealLpJCO1jPS-w==#keyword=Mobile+Firefox%3A+Other&begin=1731369600&end=1731628800&from=w0q9hlr8%40rokejulianlockhart.addy.io:~:text=Your%20request%20(-,3233006,-)%20has%20been
  2. Reproduction

    https://github.com/user-attachments/assets/fe9c113a-a940-4a63-af01-4343f5480358

    You can also watch this at YouTube.

Environment

Firefox fedora.pkgs.org/41/fedora-updates-x86_64/firefox-132.0.1-2.fc41.x86_64.rpm.html
Extension addons.mozilla.org/firefox/downloads/file/4384827/text_fragment-1.1.xpi
ichaoX commented 1 week ago

Hello, this is the expected behavior.

https://wicg.github.io/scroll-to-text-fragment/#search-invisible:~:text=A%20node%20is%20search%20invisible,of%20the%20following%20types:%20HTMLIFrameElement

https://wicg.github.io/scroll-to-text-fragment/#:~:text=top%20level%20navigables%20(i.e.%20no%20iframes).

The link you want to create is inside an <iframe>, and its src does not include the fragment. You can check this by context menu > This Frame > Frame Info > Address.

RokeJulianLockhart commented 1 week ago

@ichaoX, thanks for that. If it's deliberately not possible, then I suppose the current title shouldn't be resolved. However, I still think that the user should be notified of this, so that they don't accidentally change what's being navigated to. Should I rename the issue so?

I ask because I can think of situations in which the content of an iframe is dynamic, but the id of its adjacent element is static, so being able to navigate to that iframe is expected.

Irrespective, https://github.com/WICG/scroll-to-text-fragment/issues/240#issuecomment-1824964295, linked to from your aforereferenced section of the specification, seems to indicate that the specification maintainers are considering whether to permit this, and that it's already possible in Chrome (to an extent — if the iframe is "same-origin"). Perhaps in the future, if the spec is changed, this shall become available in Gecko, and then this can be revisited.

ichaoX commented 1 week ago

I've updated the link in https://github.com/ichaoX/ext-textFragment/issues/14#issuecomment-2476523846; the one that was deleted might have been another similar issue.

Chrome does not allow creating links for <iframe> content, and the text fragment in the location bar will not work for <iframe>.

This extension provides additional compatibility and can create links for <iframe> content in some cases. It would be better if it could be distinguished in the menu.