Skip to content

[react-interactions] Add handleSimulateChildBlur upon DOM node removal #17225

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

Merged
merged 4 commits into from
Nov 4, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Oct 30, 2019

Follow up to #17214.

This PR adds functionality to React Flare, in that a simulated blur event is fired when a DOM node being removed when it was actively focused (via the internal event system for Flare). The reason for doing it this way, opposed to within restoreSelection where it's far too late to trigger a blur event (as the DOM node has already been detached from the tree, so it's impossible to propagate such events).

@sizebot
Copy link

sizebot commented Oct 30, 2019

Size changes (experimental)

Details of bundled changes.

Comparing: a1ff9fd...1fe57d3

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js 0.0% 0.0% 123.54 KB 123.54 KB 38.79 KB 38.79 KB NODE_PROFILING
react-dom-unstable-flight-server.browser.development.js 0.0% +0.1% 5.15 KB 5.15 KB 2.01 KB 2.01 KB UMD_DEV
react-dom-unstable-flight-server.browser.production.min.js 0.0% 🔺+0.1% 1.71 KB 1.71 KB 977 B 978 B UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.88 KB 3.88 KB 1.55 KB 1.55 KB UMD_DEV
react-dom-unstable-flight-client.development.js 0.0% 0.0% 5.06 KB 5.06 KB 1.99 KB 1.99 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 11.18 KB 11.18 KB 4.15 KB 4.15 KB UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.21 KB 1.21 KB 709 B 710 B UMD_PROD
react-dom-unstable-flight-client.production.min.js 0.0% 🔺+0.1% 1.71 KB 1.71 KB 971 B 972 B UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 54.54 KB 54.54 KB 15.25 KB 15.25 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.71 KB 3.71 KB 1.5 KB 1.5 KB NODE_DEV
react-dom-unstable-flight-client.development.js 0.0% +0.2% 4.77 KB 4.77 KB 1.87 KB 1.88 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 10.95 KB 10.95 KB 4.09 KB 4.09 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.05 KB 1.05 KB 640 B 641 B NODE_PROD
react-dom-unstable-flight-client.production.min.js 0.0% 🔺+0.1% 1.47 KB 1.47 KB 843 B 844 B NODE_PROD
react-dom.development.js +0.1% +0.1% 951.45 KB 951.98 KB 215.02 KB 215.19 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 119.57 KB 119.57 KB 38.35 KB 38.35 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 123.25 KB 123.25 KB 39.44 KB 39.45 KB UMD_PROFILING
react-dom.development.js +0.1% +0.1% 945.55 KB 946.09 KB 213.43 KB 213.61 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 137.41 KB 137.41 KB 36.09 KB 36.09 KB NODE_DEV
react-dom-unstable-flight-server.node.development.js 0.0% +0.2% 5.12 KB 5.12 KB 1.92 KB 1.92 KB NODE_DEV
react-dom-unstable-flight-server.node.production.min.js 0.0% 🔺+0.3% 1.55 KB 1.55 KB 872 B 875 B NODE_PROD
react-dom-server.browser.development.js 0.0% 0.0% 136.3 KB 136.3 KB 35.87 KB 35.87 KB NODE_DEV
react-dom-unstable-flight-server.browser.development.js 0.0% +0.1% 4.85 KB 4.85 KB 1.89 KB 1.89 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 20.31 KB 20.31 KB 7.46 KB 7.46 KB NODE_PROD
react-dom-unstable-flight-server.browser.production.min.js 0.0% 🔺+0.1% 1.48 KB 1.48 KB 849 B 850 B NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.14 KB 60.14 KB 15.8 KB 15.8 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.73 KB 10.73 KB 3.67 KB 3.67 KB UMD_PROD
ReactDOM-dev.js +0.1% +0.1% 973.77 KB 974.36 KB 215.92 KB 216.14 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.1% 🔺+0.2% 401.5 KB 402.03 KB 72.88 KB 73.02 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 59.82 KB 59.82 KB 15.66 KB 15.66 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.97 KB 3.97 KB 1.53 KB 1.53 KB NODE_DEV
ReactDOM-profiling.js +0.1% +0.2% 402.33 KB 402.87 KB 73.42 KB 73.57 KB FB_WWW_PROFILING
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.1% 1.12 KB 1.12 KB 675 B 676 B NODE_PROD

Generated by 🚫 dangerJS against 1fe57d3

@sizebot
Copy link

sizebot commented Oct 30, 2019

Size changes (stable)

ReactDOM: size: 0.0%, gzip: 🔺+0.1%

Details of bundled changes.

Comparing: a1ff9fd...1fe57d3

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.46 KB 10.46 KB 3.56 KB 3.57 KB NODE_PROD
react-dom-unstable-flight-server.browser.production.min.js 0.0% 🔺+0.1% 1.46 KB 1.46 KB 840 B 841 B NODE_PROD
react-dom-unstable-flight-client.development.js 0.0% 0.0% 5.05 KB 5.05 KB 1.98 KB 1.98 KB UMD_DEV
react-dom-unstable-flight-client.production.min.js 0.0% 🔺+0.1% 1.69 KB 1.69 KB 964 B 965 B UMD_PROD
react-dom-server.browser.development.js 0.0% 0.0% 136.28 KB 136.28 KB 35.86 KB 35.86 KB NODE_DEV
react-dom-unstable-flight-server.node.development.js 0.0% +0.1% 5.1 KB 5.1 KB 1.91 KB 1.91 KB NODE_DEV
react-dom.development.js +0.1% +0.1% 951.42 KB 951.96 KB 215 KB 215.17 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.85 KB 19.85 KB 7.38 KB 7.38 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.87 KB 3.87 KB 1.54 KB 1.54 KB UMD_DEV
react-dom-unstable-flight-server.node.production.min.js 0.0% 🔺+0.1% 1.53 KB 1.53 KB 865 B 866 B NODE_PROD
react-dom.production.min.js 0.0% 0.0% 116.16 KB 116.16 KB 37.43 KB 37.43 KB UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.2 KB 1.2 KB 701 B 702 B UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 119.73 KB 119.73 KB 38.49 KB 38.49 KB UMD_PROFILING
react-dom.development.js +0.1% +0.1% 945.53 KB 946.07 KB 213.41 KB 213.59 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.7 KB 3.7 KB 1.5 KB 1.5 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 116.3 KB 116.3 KB 36.79 KB 36.79 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.04 KB 1.04 KB 633 B 634 B NODE_PROD
react-dom-unstable-flight-server.browser.development.js 0.0% +0.1% 5.13 KB 5.13 KB 2 KB 2 KB UMD_DEV
react-dom.profiling.min.js 0.0% 0.0% 119.99 KB 119.99 KB 37.84 KB 37.84 KB NODE_PROFILING
react-dom-unstable-flight-server.browser.production.min.js 0.0% 🔺+0.1% 1.7 KB 1.7 KB 968 B 969 B UMD_PROD
react-dom-unstable-flight-server.browser.development.js 0.0% +0.1% 4.84 KB 4.84 KB 1.88 KB 1.88 KB NODE_DEV
react-dom-unstable-flight-client.development.js 0.0% +0.2% 4.76 KB 4.76 KB 1.86 KB 1.87 KB NODE_DEV
react-dom-test-utils.development.js 0.0% 0.0% 56.26 KB 56.26 KB 15.57 KB 15.57 KB UMD_DEV
react-dom-unstable-flight-client.production.min.js 0.0% 🔺+0.1% 1.46 KB 1.46 KB 835 B 836 B NODE_PROD
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.96 KB 3.96 KB 1.52 KB 1.52 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 10.94 KB 10.94 KB 4.08 KB 4.08 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.11 KB 1.11 KB 666 B 667 B NODE_PROD

Generated by 🚫 dangerJS against 1fe57d3

@trueadm trueadm force-pushed the selection-simulate-focus branch from f0be201 to 1bc8a41 Compare October 31, 2019 09:27
@trueadm trueadm requested a review from necolas October 31, 2019 09:32
@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 31, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1fe57d3:

Sandbox Source
amazing-elgamal-24rcq Configuration

Copy link
Contributor

@necolas necolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dispatching only within the Flare system is a good idea

@trueadm
Copy link
Contributor Author

trueadm commented Nov 3, 2019

@sebmarkbage Please can you take another look at this PR when you get a chance? Thanks :)

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still skeptical about dispatching this within the mutation phase but accepting to unblock since it's behind Flare only.

@trueadm trueadm merged commit cb09dbe into facebook:master Nov 4, 2019
@trueadm trueadm deleted the selection-simulate-focus branch November 4, 2019 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants