Shared-Reality-Lab / IMAGE-browser

IMAGE project browser extensions & client-side code
Other
2 stars 0 forks source link

Extension seems to be inserting text "Interpret graphic with IMAGE" into overleaf documents #355

Closed jeffbl closed 8 months ago

jeffbl commented 10 months ago

We use overleaf for writing academic papers A couple of people working on two different papers (@rayanisran and @Sabrina-Knappe) have noticed the text "Interpret graphic with IMAGE" appearing in their documents, which is of course a big problem. @rayanisran points to this example: image

I don't know what is causing this, but if this happens in places other than overleaf, it is something we need to fix quickly.

@rayanisran @Sabrina-Knappe please add any additional details here!

rayanisran commented 10 months ago

The number of these "Interpret graphic with IMAGE" lines that gets added seems to correlate to number of graphics (i.e., graphics inserted with \includegraphics command) in the document, that much I know so far, but I wasn't able to trigger this bug with another Overleaf document (using v0.4.0 of the extension). Will try to replicate or keep an eye on whether it shows up elsewhere on the web...

jeffbl commented 10 months ago

@rayanisran can you specify whether you have the test or production extension installed? I have test extension installed, but I don't know if the ones I just fixed in @Sabrina-Knappe 's paper came from me, or were already there.

rayanisran commented 10 months ago

@jeffbl I'm using the test extension.

Cybernide commented 10 months ago

I'm on those papers and also the Touching Faces paper, using the test extension on Opera, but I haven't noted anything wonky there...

Cybernide commented 9 months ago

Found an instance of Interpret graphic with IMAGE in my CV!!

Image

I'll save a version of the code for you as well as the PDF

rayanisran commented 9 months ago

Amazing. What version of the extension (and was this with the test extension?) Just wondering if it's the same version as the one I had (v0.4.0).

Cybernide commented 9 months ago

It was the test extension! 0.4.53.

Cybernide commented 9 months ago

Here's hoping I didn't apply to any funding with that

rayanisran commented 8 months ago

I did some testing and it looks like the problem is in the processGraphics function in buttons.js. Although the function only looks for elements with the img tag, there are hidden elements on an Overleaf document that have this tag but don't have an src attribute, unlike standard images. A straightforward but hacky fix for now is to just check whether an src attribute exists on the detected element and ignore processing ones that don't:

  for (let image of images) {

    if (!image.hasAttribute("src"))
      continue;

...

This solved the issue for me, but I haven't checked whether the code impacts any screen readers/other sites.

jaydeepsingh25 commented 8 months ago

Woah, Thanks for looking into it @rayanisran , This seems like a valid check. Please feel free to raise a PR.