Skip to content

Commit

Permalink
Trap click event on container in appendChildToContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Dail authored and Brandon Dail committed Jan 5, 2018
1 parent 6a51298 commit 879cc35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions packages/react-dom/src/client/ReactDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const {
warnForDeletedHydratableText,
warnForInsertedHydratedElement,
warnForInsertedHydratedText,
trapClickOnNonInteractiveElement
trapClickOnNonInteractiveElement,
} = ReactDOMFiberComponent;
const {updatedAncestorInfo} = validateDOMNesting;
const {precacheFiberNode, updateFiberProps} = ReactDOMComponentTree;
Expand Down Expand Up @@ -761,7 +761,11 @@ const DOMRenderer = ReactFiberReconciler({
): void {
if (container.nodeType === COMMENT_NODE) {
(container.parentNode: any).insertBefore(child, container);
trapClickOnNonInteractiveElement(
((container.parentNode: any): HTMLElement),
);
} else {
trapClickOnNonInteractiveElement(((container: any): HTMLElement));
container.appendChild(child);
}
},
Expand Down Expand Up @@ -1126,7 +1130,6 @@ function createPortal(
isValidContainer(container),
'Target container is not a DOM element.',
);
trapClickOnNonInteractiveElement(((container: any): HTMLElement));
// TODO: pass ReactDOM portal implementation as third argument
return ReactPortal.createPortal(children, container, null, key);
}
Expand Down
24 changes: 12 additions & 12 deletions scripts/rollup/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,43 +46,43 @@
"filename": "react-dom.development.js",
"bundleType": "UMD_DEV",
"packageName": "react-dom",
"size": 560498,
"gzip": 132755
"size": 560769,
"gzip": 132795
},
{
"filename": "react-dom.production.min.js",
"bundleType": "UMD_PROD",
"packageName": "react-dom",
"size": 93742,
"gzip": 30770
"size": 93808,
"gzip": 30830
},
{
"filename": "react-dom.development.js",
"bundleType": "NODE_DEV",
"packageName": "react-dom",
"size": 544531,
"gzip": 128982
"size": 544802,
"gzip": 129020
},
{
"filename": "react-dom.production.min.js",
"bundleType": "NODE_PROD",
"packageName": "react-dom",
"size": 92163,
"gzip": 29827
"size": 92229,
"gzip": 29877
},
{
"filename": "ReactDOM-dev.js",
"bundleType": "FB_DEV",
"packageName": "react-dom",
"size": 562017,
"gzip": 131222
"size": 562289,
"gzip": 131261
},
{
"filename": "ReactDOM-prod.js",
"bundleType": "FB_PROD",
"packageName": "react-dom",
"size": 265467,
"gzip": 51292
"size": 265786,
"gzip": 51347
},
{
"filename": "react-dom-test-utils.development.js",
Expand Down

0 comments on commit 879cc35

Please sign in to comment.