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

Events not registered inside Shadow DOM #1430

Open
osener opened this Issue Jan 4, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@osener
Copy link

osener commented Jan 4, 2019

When mounted inside a Shadow DOM root, components rendered with Inferno do not handle events. Tested with Chrome 69 and Inferno 7.0.5.

Test case: https://codesandbox.io/s/3v17o2zwx5

@osener

This comment has been minimized.

Copy link

osener commented Jan 4, 2019

Just tried using non-synthetic events per #1429 (comment) and it worked. Unfortunately, I'm using inferno-compat alias in a ReasonReact application, so unfortunately this workaround is not usable for me (at least without some fragile build-time tricks).

I want to congratulate you for the amazing work though! I tried at least two more "React-compatible" libraries, but none of them worked as expected with ReasonReact, (probably) because of the incorrect assumptions they make about React internals. Whereas Inferno works like a charm as a drop-in replacement even in an app that relies on React 16 features.

@Havunen

This comment has been minimized.

Copy link
Member

Havunen commented Jan 5, 2019

One possible way to add support for this could be that when going through html Nodes, we check if htmlNode.host exists and if it does we opt-out from synthetic events. This might have some negative performance impact because it needs to check all nodes. And when host document ( Shadow-root) is detected it would opt-out from synthetic events.

Better ideas are welcome

@osener

This comment has been minimized.

Copy link

osener commented Jan 5, 2019

@Havunen using ":host *" CSS selector seems to be faster: https://jsperf.com/shadow-root-detection/1

@osener

This comment has been minimized.

Copy link

osener commented Jan 5, 2019

What do you think about doing this check at mount point and globally disabling synthetic events for all nodes? I don't expect inferno to support shadow roots under sub nodes.

@Havunen

This comment has been minimized.

Copy link
Member

Havunen commented Jan 6, 2019

Yeah thats what I thought. Reading host property when going through the Nodes (mount/patch) and then opting out from synthetic event system If shadow root is detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment