uetchy/Polyglot

Screen junk with latest update

StanleyKnife opened this issue · 17 comments

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):

  • Version 3.2

polyglot issue

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.

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

that's the problem!

What type of edit control is the page using?

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!

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.

I thought that in #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!

I am getting this in every text area:

  • Wordpress
  • Wikipedia
  • Internet Archive

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

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

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

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

  • do something on the page to change DOM before popup is dismissed and we lose control of the popup and its HTML code
  • popup HTML should not be added to text area

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.

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.

I'll also think about this problem.

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

  • Internet Archive: div.wysiwyg iframe
  • WordPress: div.mce-tinymce
  • Wikipedia: div.ve-ce-surface

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.