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

undefined - google translate broke some button #357

Open
My9xVm opened this issue Mar 27, 2019 · 3 comments

Comments

2 participants
@My9xVm
Copy link

commented Mar 27, 2019

No description provided.

@My9xVm

This comment has been minimized.

Copy link
Author

commented Mar 27, 2019

GIF

@aeoris

This comment has been minimized.

Copy link
Contributor

commented Apr 4, 2019

This is happening because Google Translate is adding some <font> elements within the translated tags and then cloning their Javascript listeners. When the user clicks on the Javascript-enabled links, the event.target is not the link as we expected, but instead an inner <font> element, so when an event reaches our click handlers, that expect just certain elements with some data-* attributes, those elements can't be found (as those are levels above in the DOM hierarchy).

The save button (before):
image

The save button (after):
image

A couple possible ideas to fix that could be:

  • adding guard clauses on the click handlers, to check whether the elements are as expected and the attributes are present
  • when handling the click event, find the nearest matching parent element (for instance, an <a> parent with the required data-* attributes)

As I don't know how other translation services work, the fix made for this bug could be not enough for fixing the use of miniflux with other services, though.

@My9xVm

This comment has been minimized.

Copy link
Author

commented Apr 11, 2019

Both Google and Microsoft support class="notranslate" 1

It looks OK.

2

  1. Using HTML's translate attribute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.