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

React events: Press event fixes #15386

Merged
merged 5 commits into from
Apr 11, 2019

Conversation

necolas
Copy link
Contributor

@necolas necolas commented Apr 11, 2019

  1. Fix hiding context menu for longpress via touch.
  2. Fix scrolling of viewport for longpress via spacebar key.
  3. Add tests for anchor-related behaviour and preventDefault.
  4. Add a deactivation delay for forced activation
  5. Add pointerType to Press events.

NOTE: this currently extends pointerType with non-standard types. We could consider using a different name, like inputMode or something.

NOTE: React Native doesn't have a deactivation delay for forced activation, but this is possibly because of the async bridge meaning that the events aren't dispatched sync.

Ref #15257

@sizebot
Copy link

sizebot commented Apr 11, 2019

Details of bundled changes.

Comparing: 9672cf6...2f6ab3e

react-events

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-events.development.js 0.0% -0.1% 1.59 KB 1.59 KB 688 B 687 B UMD_DEV
react-events.production.min.js 0.0% -0.2% 857 B 857 B 477 B 476 B UMD_PROD
react-events.development.js 0.0% -0.2% 1.4 KB 1.4 KB 626 B 625 B NODE_DEV
react-events.production.min.js 0.0% 🔺+0.3% 698 B 698 B 400 B 401 B NODE_PROD
react-events-press.development.js +10.9% +7.7% 17.98 KB 19.94 KB 4.41 KB 4.75 KB UMD_DEV
react-events-press.production.min.js 🔺+7.2% 🔺+4.6% 7.24 KB 7.76 KB 2.52 KB 2.64 KB UMD_PROD
react-events-press.development.js +11.0% +7.7% 17.81 KB 19.77 KB 4.38 KB 4.71 KB NODE_DEV
react-events-press.production.min.js 🔺+7.3% 🔺+4.7% 7.08 KB 7.59 KB 2.47 KB 2.59 KB NODE_PROD
ReactEventsPress-dev.js +11.4% +8.7% 16.21 KB 18.05 KB 3.67 KB 3.99 KB FB_WWW_DEV
ReactEventsPress-prod.js 🔺+11.2% 🔺+9.0% 13.46 KB 14.96 KB 2.71 KB 2.96 KB FB_WWW_PROD
react-events-hover.development.js +0.3% +0.5% 6.75 KB 6.77 KB 1.79 KB 1.8 KB UMD_DEV
react-events-hover.production.min.js 🔺+0.3% 🔺+1.3% 3.02 KB 3.03 KB 1.15 KB 1.17 KB UMD_PROD
react-events-hover.development.js +0.3% +0.5% 6.58 KB 6.6 KB 1.75 KB 1.76 KB NODE_DEV
react-events-hover.production.min.js 🔺+0.3% 🔺+0.2% 2.86 KB 2.87 KB 1.1 KB 1.1 KB NODE_PROD
ReactEventsHover-dev.js +0.3% +0.5% 6.79 KB 6.81 KB 1.77 KB 1.77 KB FB_WWW_DEV
ReactEventsHover-prod.js 🔺+0.3% 🔺+0.5% 5.96 KB 5.98 KB 1.47 KB 1.48 KB FB_WWW_PROD
react-events-focus.development.js 0.0% -0.1% 3.29 KB 3.29 KB 1.11 KB 1.11 KB UMD_DEV
react-events-focus.production.min.js 0.0% -0.1% 1.52 KB 1.52 KB 740 B 739 B UMD_PROD
react-events-focus.development.js 0.0% -0.1% 3.12 KB 3.12 KB 1.06 KB 1.06 KB NODE_DEV
react-events-focus.production.min.js 0.0% -0.1% 1.35 KB 1.35 KB 672 B 671 B NODE_PROD
react-events-swipe.development.js 0.0% -0.1% 8.29 KB 8.29 KB 2.57 KB 2.57 KB UMD_DEV
react-events-swipe.production.min.js 0.0% -0.1% 3.46 KB 3.46 KB 1.61 KB 1.61 KB UMD_PROD
react-events-swipe.development.js 0.0% -0.0% 8.12 KB 8.12 KB 2.53 KB 2.53 KB NODE_DEV
react-events-swipe.production.min.js 0.0% -0.1% 3.29 KB 3.29 KB 1.55 KB 1.55 KB NODE_PROD
react-events-drag.development.js 0.0% -0.0% 7.8 KB 7.8 KB 2.44 KB 2.44 KB UMD_DEV
react-events-drag.production.min.js 0.0% -0.1% 3.3 KB 3.3 KB 1.5 KB 1.5 KB UMD_PROD
react-events-drag.production.min.js 0.0% -0.1% 3.14 KB 3.14 KB 1.44 KB 1.44 KB NODE_PROD

Generated by 🚫 dangerJS

if (nativeEvent.pointerType != null) {
return nativeEvent.pointerType;
}
if (nativeEvent.type.indexOf('mouse') > -1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could type be pulled out to its own variable? Seems like a lot of property accesses each time otherwise and should reduce prod code size.

Copy link
Contributor

@trueadm trueadm left a comment

Choose a reason for hiding this comment

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

Minus the nit, looks good to me! Will need rebasing with master too :)

@necolas necolas force-pushed the react-events/misc-fixes branch from 60439f7 to f08ce74 Compare April 11, 2019 19:42
@necolas necolas force-pushed the react-events/misc-fixes branch from f08ce74 to 2f6ab3e Compare April 11, 2019 20:03
@necolas necolas merged commit 45473c9 into facebook:master Apr 11, 2019
@necolas necolas deleted the react-events/misc-fixes branch May 3, 2019 17:35
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.

4 participants