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

Unify Flare FocusWithin responder with useFocusWithin #18636

Merged
merged 2 commits into from Apr 16, 2020

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 16, 2020

This PR unifies the Flare FocusWithin responder with the recent useFocusWithin responder so the Flare version uses a fake afterblur rather the fake blur. This means we can easily A/B test the various implementations that rely on this internally. I've also added FocusRegion tests that confirm the functionality matches that as we expect internally too.

@trueadm trueadm requested review from necolas and gaearon April 16, 2020 13:41
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 16, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 16, 2020

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 1ddda57:

Sandbox Source
lingering-architecture-czk5b Configuration

@sizebot
Copy link

sizebot commented Apr 16, 2020

Details of bundled changes.

Comparing: 71964c0...1ddda57

react-interactions

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-interactions-events/hover.development.js 0.0% -0.1% 8.47 KB 8.47 KB 1.73 KB 1.73 KB UMD_DEV
react-interactions-events/hover.production.min.js 0.0% -0.2% 3.49 KB 3.49 KB 1.24 KB 1.24 KB UMD_PROD
react-interactions-events/context-menu.development.js 0.0% -0.3% 2.86 KB 2.86 KB 1.05 KB 1.05 KB UMD_DEV
react-interactions-events/press-legacy.development.js 0.0% -0.0% 24.74 KB 24.74 KB 6.02 KB 6.02 KB UMD_DEV
react-interactions-events/context-menu.production.min.js 0.0% -0.5% 1.42 KB 1.42 KB 758 B 754 B UMD_PROD
ReactEventsFocus-dev.js +2.4% +0.3% 15.89 KB 16.28 KB 3.31 KB 3.32 KB FB_WWW_DEV
react-interactions-events/press-legacy.production.min.js 0.0% -0.1% 7.32 KB 7.32 KB 2.76 KB 2.76 KB UMD_PROD
ReactEventsFocus-prod.js 🔺+3.1% 🔺+1.7% 12.15 KB 12.52 KB 2.32 KB 2.36 KB FB_WWW_PROD
react-interactions-events/context-menu.development.js 0.0% -0.2% 2.5 KB 2.5 KB 991 B 989 B NODE_DEV
react-interactions-events/press-legacy.development.js 0.0% -0.0% 23.34 KB 23.34 KB 5.89 KB 5.89 KB NODE_DEV
react-interactions-events/context-menu.production.min.js 0.0% -0.4% 1.22 KB 1.22 KB 682 B 679 B NODE_PROD
react-interactions-events/press-legacy.production.min.js 0.0% -0.1% 7.12 KB 7.12 KB 2.69 KB 2.69 KB NODE_PROD
react-interactions-events/keyboard.development.js 0.0% -0.0% 5.75 KB 5.75 KB 2.21 KB 2.21 KB NODE_DEV
react-interactions-events/hover.development.js 0.0% -0.1% 7.75 KB 7.75 KB 1.64 KB 1.64 KB NODE_DEV
react-interactions-events/hover.production.min.js 0.0% -0.3% 3.3 KB 3.3 KB 1.17 KB 1.16 KB NODE_PROD
react-interactions-events/deprecated-focus.development.js +2.3% +0.1% 16.87 KB 17.25 KB 3.38 KB 3.38 KB UMD_DEV
react-interactions-events/deprecated-focus.production.min.js 🔺+2.4% 🔺+1.2% 5.43 KB 5.56 KB 1.8 KB 1.82 KB UMD_PROD
react-interactions-events/deprecated-focus.development.js +2.3% +0.1% 15.78 KB 16.15 KB 3.28 KB 3.28 KB NODE_DEV
react-interactions-events/deprecated-focus.production.min.js 🔺+2.5% 🔺+1.3% 5.25 KB 5.38 KB 1.72 KB 1.75 KB NODE_PROD

Size changes (experimental)

Generated by 🚫 dangerJS against 1ddda57

@sizebot
Copy link

sizebot commented Apr 16, 2020

Details of bundled changes.

Comparing: 71964c0...1ddda57

react-interactions

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-interactions-events/context-menu.development.js 0.0% -0.2% 2.84 KB 2.84 KB 1.04 KB 1.04 KB UMD_DEV
react-interactions-events/keyboard.production.min.js 0.0% -0.1% 2.26 KB 2.26 KB 1.18 KB 1.18 KB NODE_PROD
react-interactions-events/context-menu.production.min.js 0.0% -0.3% 1.41 KB 1.41 KB 749 B 747 B UMD_PROD
react-interactions-events/press-legacy.development.js 0.0% -0.0% 23.33 KB 23.33 KB 5.88 KB 5.88 KB NODE_DEV
react-interactions-events/deprecated-focus.development.js +2.3% +0.1% 16.86 KB 17.24 KB 3.37 KB 3.38 KB UMD_DEV
react-interactions-events/press-legacy.production.min.js 0.0% -0.1% 7.11 KB 7.11 KB 2.68 KB 2.68 KB NODE_PROD
react-interactions-events/deprecated-focus.production.min.js 🔺+2.4% 🔺+1.2% 5.42 KB 5.55 KB 1.79 KB 1.81 KB UMD_PROD
react-interactions-events/deprecated-focus.development.js +2.3% +0.1% 15.77 KB 16.13 KB 3.27 KB 3.28 KB NODE_DEV
react-interactions-events/deprecated-focus.production.min.js 🔺+2.5% 🔺+1.3% 5.24 KB 5.37 KB 1.72 KB 1.74 KB NODE_PROD
react-interactions-events/keyboard.development.js 0.0% -0.0% 6.31 KB 6.31 KB 2.31 KB 2.31 KB UMD_DEV
ReactEventsFocus-dev.js +2.4% +0.3% 15.89 KB 16.28 KB 3.31 KB 3.32 KB FB_WWW_DEV
ReactEventsFocus-prod.js 🔺+3.1% 🔺+1.7% 12.15 KB 12.52 KB 2.32 KB 2.36 KB FB_WWW_PROD
react-interactions-events/context-menu.development.js 0.0% -0.3% 2.49 KB 2.49 KB 983 B 980 B NODE_DEV
react-interactions-events/context-menu.production.min.js 0.0% -0.4% 1.2 KB 1.2 KB 673 B 670 B NODE_PROD
react-interactions-events/hover.development.js 0.0% -0.2% 8.46 KB 8.46 KB 1.72 KB 1.72 KB UMD_DEV
react-interactions-events/hover.production.min.js 0.0% -0.2% 3.48 KB 3.48 KB 1.23 KB 1.23 KB UMD_PROD
react-interactions-events/hover.development.js 0.0% -0.1% 7.74 KB 7.74 KB 1.63 KB 1.63 KB NODE_DEV
react-interactions-events/hover.production.min.js 0.0% -0.3% 3.28 KB 3.28 KB 1.16 KB 1.15 KB NODE_PROD
react-interactions-events/press-legacy.development.js 0.0% -0.0% 24.73 KB 24.73 KB 6.01 KB 6.01 KB UMD_DEV
react-interactions-events/press-legacy.production.min.js 0.0% -0.1% 7.31 KB 7.31 KB 2.75 KB 2.75 KB UMD_PROD

Size changes (stable)

Generated by 🚫 dangerJS against 1ddda57

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.

Yikes these tests are complicated. I don't even remember what all the before/after stuff is for

@trueadm
Copy link
Contributor Author

trueadm commented Apr 16, 2020

@necolas The tests were adapted and taken from internal code for FocusRegion that fully uses the functions as we do internally – helps cover regressions until we move this out of Github.

@necolas
Copy link
Contributor

necolas commented Apr 16, 2020

We have a focus hook that is testing itself against a different user space abstraction that has to be built up in the test. The complexity suggests the divisions might not be right because you can't be sure of the behavior without doing this

@trueadm
Copy link
Contributor Author

trueadm commented Apr 16, 2020

I've removed the tests from this PR.

@necolas
Copy link
Contributor

necolas commented Apr 16, 2020

I'm not saying whether or not the tests should be part of the PR :) Just that if these sorts of tests are needed to verify the behavior of this hook, then maybe we're missing something about where this functionality belongs

@trueadm
Copy link
Contributor Author

trueadm commented Apr 16, 2020

@necolas They're not needed to verify the behavior at all, I just brought them in to verify I didn't make any mistakes, given they pass with it, and I don't anticipate making any more changes, it should be fine.

Furthermore, I guess given that we plan on migrating these to FB soon, where they'll get the full test coverage of FocusRegion's tests, it makes sense to leave it till then and not bring them in right now. The sync would fail if we broke something anyway.

@trueadm trueadm merged commit f24a9e7 into facebook:master Apr 16, 2020
@trueadm trueadm deleted the focus-within branch April 16, 2020 18:35
trueadm added a commit to trueadm/react that referenced this pull request Apr 17, 2020
trueadm added a commit that referenced this pull request Apr 17, 2020
* Revert "Further cleanup to before/after blur (#18649)"

This reverts commit e2ccbf0.

* Revert "Unify Flare FocusWithin responder with useFocusWithin (#18636)"

This reverts commit f24a9e7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants