uetchy / Polyglot

🌏 The missing Safari extension that translates selected text into your native language.
Other
482 stars 44 forks source link

Screen junk with latest update #88

Open StanleyKnife opened 3 years ago

StanleyKnife commented 3 years ago

Describe the bug When Polyglot is loaded, a pages with Arabic text shows an always-on grey box. Text highlighted for translation shows a spinning box top left.

Screenshots

Always-on box at top, highlighted translation bottom.

Version (please complete the following information):

polyglot issue

gingerbeardman commented 3 years ago

I'm not able to reproduce

using https://ar.wikipedia.org/wiki/بدر_البوسعيدي as a test

StanleyKnife commented 3 years ago

Sorry - the site is fm.gov.om and I'm finding this issue each time I turn Polyglot back on. My co-workers are finding the same issue.

StanleyKnife commented 3 years ago

OK this is really odd. I've found that when I translated some text while editing the page (and thanks for that new ability, by the way) the following code was inserted in the panel I was editing:

image

gingerbeardman commented 3 years ago

that's the problem!

What type of edit control is the page using?

StanleyKnife commented 3 years ago

It's the Avada theme, which has its own editing environment.

Previously Polyglot was unable to translate Arabic text within the editor window, so it wasn't an issue. I think I should just remember not to use it here.

By the way, Polyglot is a fantastic tool. Exactly what I need. Thank you!

gingerbeardman commented 3 years ago

I have also had Polyglot leaving text inside of text fields after selecting text in text field. I was editing an item on archive.org at the time.

StanleyKnife commented 3 years ago

Yes, it seems to happen when you translate text inside an edit field. Works fine on non-editing web pages.

On 12 Feb 2021, at 10:01, Matt Sephton notifications@github.com wrote:

I have also had Polyglot leaving text inside of text fields after selecting text in text field. I was editing an item on archive.org at the time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uetchy/Polyglot/issues/88#issuecomment-778097962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYV46QEHKPZ7N2P7ATM3STS6T355ANCNFSM4WK2VD4Q.

gingerbeardman commented 3 years ago

I thought that in https://github.com/uetchy/Polyglot/issues/28 translation was disabled in text field? @uetchy

because it's most likely the words in there are either in your own language, or words I am typing myself!

StanleyKnife commented 3 years ago

No, you can still translate - but the extra code is inserted when you do.

On 13 Feb 2021, at 13:37, Matt Sephton notifications@github.com wrote:

I thought that in #28 https://github.com/uetchy/Polyglot/issues/28 translation was disabled in text field? @uetchy https://github.com/uetchy because it's most likely the words in there are either in your own language, or words I am typing myself!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uetchy/Polyglot/issues/88#issuecomment-778620707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYV46WDTUNV7JLPXN3K76DS6Z6CTANCNFSM4WK2VD4Q.

gingerbeardman commented 3 years ago

I am getting this in every text area:

It's very disruptive because I have to check and delete the stray html

uetchy commented 3 years ago

Actually I couldn't reproduce this bug. Could you give me a complete and precise procedure to reproduce the bug?

gingerbeardman commented 3 years ago

Sure!

it is too easy to lose control of the popup and for its HTML to be saved with the contents of the text area.

Screen recording:

Setup:

  1. goto https://archive.org/create/
  2. click: Upload Files
  3. select a local file to upload (we're not actually going to upload it)
  4. click: description field
  5. type some description
  6. select the text you have just typed

Problems:

  1. spinner never goes away
  2. multiple popups
  3. top left popup is not under your direct control
Screen shot 2021-03-18 at 10 15 58

Next, without dismissing the popup:

  1. click into another field, eg. Subject tags
  2. click back into Description field
  3. choose <> button (html code view)

Problem:

  1. the code for the popup remains in the text field
  2. clicking on the text field will remove the old popup code
Screen shot 2021-03-18 at 10 29 09
gingerbeardman commented 3 years ago

Similarly, with WordPress:

Screen shot 2021-03-18 at 10 43 27

I do not have time to show Wikipedia, but the process is the same.

Basically

uetchy commented 3 years ago
Screen Shot 2021-03-19 at 5 42 17 PM

I can confirm. That's a bit tricky problem. Normally Polyglot can suppress instant translation when the selected text is in a textarea or input tag, but in this case the editor is just a body inside iframe that Polyglot cannot tell it's an editable text.

uetchy commented 3 years ago

Disabling handling iframe is the easiest route, but I don't want to do it because it also prevents me from translating live chat comments on YouTube. We need to find another solution to this.

gingerbeardman commented 3 years ago

I'll also think about this problem.

gingerbeardman commented 3 years ago

Just to make some notes on possible exclusion list of selectors:

An option to disable in iframe could be possible? Or only disable iframe on certain sites? This would only fix Internet Archive.

Could the popup be created at top level of DOM? Immediately after body tag, and then positioned absolutely? Just thinking out loud.