Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing hint with iframes and iframe.contentDocument.write() #86

Open
the-blank-x opened this issue Sep 9, 2023 · 1 comment
Open

Comments

@the-blank-x
Copy link

URL

The original page is under an account, and I don't feel comfortable sharing my creds, so here's two pages that I can reproduce this with: cke.html.gz and re.html.gz

Screen shot

Description

My school's management system uses readonly CKEditor instances peppered around the site to display user-generated content, but Link Hints does not hint any links inside those CKEditor instances. I've more or less recreated what they've done in cke.html, and I've reproduced the bug with only vanilla JS in re.html by looking through CKEditor's source code.

It seems like iframe.contentDocument.write(...) gets rid of Link Hints' event listeners, as you can see here:

If i replace iframe.contentDocument.write(...) with iframe.contentDocument.body.innerHTML = ... (and remove the open(...)/close() lines), Link Hints can see the links inside:

Debug info

Debug info
{
  "version": "1.3.1",
  "browser": "firefox",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0",
  "browserInfo": {
    "name": "Firefox",
    "vendor": "LibreWolf",
    "version": "117.0-1",
    "buildID": "20230830051056"
  },
  "platformInfo": {
    "os": "linux",
    "arch": "x86-64"
  },
  "storage.sync": {
    "debug.ElementManager.ATTRIBUTES_CLICKABLE": [
      "aria-checked",
      "aria-selected",
      "data-dismiss",
      "data-ember-action",
      "data-image-url",
      "data-line-number",
      "data-permalink-path"
    ],
    "css": ".root {\n    /* https://github.com/lydell/LinkHints/issues/82 */\n    text-shadow: initial;\n}",
    "hints.shift-Enter": "ActivateHint",
    "debug.ElementManager.ROLES_CLICKABLE": [
      "button",
      "checkbox",
      "link",
      "menuitem",
      "menuitemcheckbox",
      "menuitemradio",
      "option",
      "radio",
      "searchbox",
      "spinbutton",
      "switch",
      "tab",
      "textbox"
    ],
    "normal.ctrl-j": "EnterHintsMode_Click",
    "normal.ctrl-k": "EnterHintsMode_BackgroundTab",
    "normal.ctrl-J": "EnterHintsMode_ManyClick",
    "normal.ctrl-K": "EnterHintsMode_ManyTab",
    "normal.ctrl-L": "EnterHintsMode_Select",
    "normal.ctrl-:": "EnterHintsMode_ForegroundTab",
    "hints.ctrl-Enter": "ActivateHintAlt",
    "hints.shift-Backspace": "Backspace",
    "debug.ElementManager.REGEX_CLICKABLE_CLASS": "\\bcm-|ͼ|\\bmtk|sparkline-year-label|js-wiki-toggle-collapse"
  },
  "storage.local": {
    "tutorialShown": true
  },
  "language": "en-US"
}
@lydell
Copy link
Owner

lydell commented Sep 9, 2023

Hi! I have also noticed Link Hints not working properly with iframes anymore, not even my own iframe tests: https://github.com/lydell/LinkHints/tree/main/html/frames

As far as I remember, I had the same problems both in Firefox and Chrome.

I haven’t changed anything in Link Hints, so something must have changed in Firefox and Chrome. Weird! But should be fixable after a debugging session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants