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

fix: 解决 React 等将事件处理统一放在 Document 上, 导致 shadowDom 下事件不触发的问题 #35

Merged
merged 2 commits into from
Aug 13, 2020

Conversation

chenjigeng
Copy link
Collaborator

主要是解决这个问题:facebook/react#9242

在 ShadowDom 下渲染 React 应用的时候,会发现 React 的所有事件都无法触发。
这个是由于 ShadowDom 里触发的事件,在外层拿到 event.target 的时候,只会拿到 host,所以导致了 react 的事件调度出现了问题。

@yisar
Copy link
Collaborator

yisar commented Aug 13, 2020

我一直以为 react 最新版本已经不再将时间收集到 document 上了,可否提供一个最简用例,先确认下最新版本是否有问题
因为按照 berial 的模型,如果是挂到 rootNode 上,其实是不不要突破沙雕的,理论上是可行的
当然即便最新版本问题不大,我们也有必要 polyfill 到更低的版本,毕竟微前端就是用来干这个的

@yisar
Copy link
Collaborator

yisar commented Aug 13, 2020

我合并啦,阿里嘎多,预想中会有更多的坑,如果作为 polyfill 就好了

@yisar yisar merged commit c6a9b2e into berialjs:master Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants