ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.61k stars 336 forks source link

Editor freezes page when using the translate option of the Edge browser #1340

Closed yanmariomenev closed 1 year ago

yanmariomenev commented 1 year ago

The Microsoft Edge browser's built-in translate tool (from the context menu) freezes the entire page if a ProseMirror editor is present in the DOM.

This behavior can be observed on the ProseMirror home page or in the Kendo UI Library Editors that use ProseMirror.

If needed I can provide a runnable application and screen recording.

Tested on Edge for Mac and Windows. Google Chrome translation doesn't seem to be affected and the page doesn't freeze.

Screenshots

K85dYMRVp6 msedge_EKPtaTn0Vj

marijnh commented 1 year ago

This may be a loop between that tool messing with the editable DOM and ProseMirror fixing it up again. Frankly, I feel the blame for that is on the translation tool. Ideally, since they don't seem to respect the translate=no attribute, we'd find some other attribute to make them leave the content well enough alone. Have you searched for such a thing? Translating editable content is problematic for a number of reasons, but somehow these in-page translators don't seem to take that into account.

marijnh commented 1 year ago

Supposedly Edge respects translate=no, making it even more strange that this is happening.

yanmariomenev commented 1 year ago

I haven't done research on the matter, but it seems that the page crashing stops when the Editor is inside a div containing the class="notranslate" (example).

marijnh commented 1 year ago

Odd. Could you see if adding an attributes: {class: "notranslate"} directly to the editor configuration also solves this? Maybe it is just picking up that, and not translate=no, despite claiming to support both.

yanmariomenev commented 1 year ago

I did add the class directly to the kendo editor and the page still crashed. That is why I've placed it in a div containing the class and seems to work that way, which is kind of strange. It is also interesting that now I've added the translate="no" attribute directly to the kendo editor and the page doesn't crash.

      `<kendo-editor translate="no" [value]="value"></kendo-editor>`
marijnh commented 1 year ago

I tried to reproduce this, but I don't see it happening. Edge translates the content outside of the editor, but leaves the editable text intact. Are you using a halfway recent version of ProseMirror that actually uses the translate=no attribute on the editable content?

yanmariomenev commented 1 year ago

I am not very familiar with ProseMirror, but the versions that are used by the Editor are as follows:

"dependencies": { "prosemirror-commands": "1.3.1", "prosemirror-history": "1.3.0", "prosemirror-inputrules": "1.2.0", "prosemirror-keymap": "1.2.0", "prosemirror-model": "1.18.3", "prosemirror-schema-list": "1.2.2", "prosemirror-state": "1.4.2", "prosemirror-view": "1.29.1", "prosemirror-dropcursor": "1.6.1", "prosemirror-gapcursor": "1.3.1", "prosemirror-tables": "1.2.5", "prosemirror-transform": "1.7.0", "tslib": "^2.4.0" }

marijnh commented 1 year ago

That's the current version, which definitely adds translate=no to its DOM element.

yanmariomenev commented 1 year ago

It seems that both approaches that I've mentioned above aren't exactly working and the page still crashes. Not sure if this is fully related to the translation tool that Edge uses or if something else can be done on the ProseMirror side.

marijnh commented 1 year ago

The first question then would be whether you can reproduce this on any page using ProseMirror, or only on yours.

yanmariomenev commented 1 year ago

I was able to reproduce it on the main page of ProseMirror where there is one editor for demonstration. Also crashes in the following standalone project - https://stackblitz.com/edit/react-prosemirror-editor-wpcko1?file=index.js It isn't mine, but I manage to update it and reproduce the freezing when typing something in the editor and using the translation tool of Edge.

marijnh commented 1 year ago

I can reproduce this in Edge 107, but the problem doesn't occur in Edge 89, which just cleanly translates text outside the editor and nothing more. So I'd say this is a regression in Edge, and I don't think ProseMirror can do anything about it. You could try reporting it to Microsoft.

yanmariomenev commented 1 year ago

I've sent a report to the Microsoft Edge team via their feedback form. I will post any updates on their side here and maybe they will update us directly on this issue :)

Young6118 commented 1 year ago

我也遇到了这个问题

charles-at-stack commented 1 year ago

This was apparently fixed in Edge 112.0.1722.34.

marijnh commented 1 year ago

That great to hear. Closing this issue.