Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/react-dom/src/events/getEventTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ function getEventTarget(nativeEvent) {
// Fallback to nativeEvent.srcElement for IE9
// https://github.com/facebook/react/issues/12506
let target = nativeEvent.target || nativeEvent.srcElement || window;
// This is for solve the webcomponent event not working issue. And it will works on all the browsers which are all support the shadowDom.
// https://github.com/facebook/react/issues/9242
let targetPath =
nativeEvent.path ||
(nativeEvent.composedPath && nativeEvent.composedPath());
if (target.shadowRoot && targetPath && targetPath.length) {
target = targetPath[0];
}

// Normalize SVG <use> element events #4963
if (target.correspondingUseElement) {
Expand Down