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

Popups don't work inside Shadow DOM #865

Closed
eemorozov opened this issue Jul 12, 2022 · 0 comments
Closed

Popups don't work inside Shadow DOM #865

eemorozov opened this issue Jul 12, 2022 · 0 comments

Comments

@eemorozov
Copy link

eemorozov commented Jul 12, 2022

Jodit Version: 3.18.9

Browser: Chrome/FF
OS: Windows
Is React App: True

Code
CodeSandbox

Expected behavior:
If you try to select image or table, popup with additional menu should be shown.

Actual behavior:
Popup is not shown:

  1. const node = e.target as Node;

    Component bind click event to window and check target inside callback. This doesn't work with Shadow DOM (e.target is Shadow DOM host every time). We have to use "path" instead of target.
    I made CodeSandbox example.
    Here I patch Select plugin "onOutsideClick" method with "getEventTarget" helper.
    If you try to select image - poppup will work (but not the case with table, see next)
    So instead of patching we should just use "getEventTarget" everywhere.

  2. const node = this.j.ed.elementFromPoint(e.clientX, e.clientY);

    Because of that condition popup is shown and closed at the same time - "document.elementFromPoint" method can't search inside Shadow DOM.
    I made another CodeSandbox example where "document.elementFromPoint" patched with helper method with deep search.
    So instead of patching we should just use "elementFromPoint" everywhere.

@xdan xdan added the bug label Aug 11, 2022
xdan added a commit that referenced this issue Aug 14, 2022
@xdan xdan added the fixed label Aug 14, 2022
@xdan xdan closed this as completed Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants