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] Tap support for virtual click #16755

Conversation

necolas
Copy link
Contributor

@necolas necolas commented Sep 11, 2019

A couple of issues:

  1. This implementation can't be used to produce visual feedback as the entire sequence is flushed for the same event. We could wrap the "end" phase in a setTimeout to support this.

  2. Changing the targetEventTypes to use click instead of click_active results in no click event being dispatched to onRootEvent, even though rootEventTypes contains click_active.

@sizebot
Copy link

sizebot commented Sep 11, 2019

Details of bundled changes.

Comparing: 3717c25...dca1a57

react-events

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-events-focus.development.js 0.0% -0.1% 10.91 KB 10.91 KB 2.36 KB 2.35 KB UMD_DEV
react-events-press.development.js 0.0% -0.0% 20.69 KB 20.69 KB 4.82 KB 4.82 KB UMD_DEV
react-events-focus.production.min.js 0.0% -0.1% 4.09 KB 4.09 KB 1.39 KB 1.39 KB UMD_PROD
react-events-press.production.min.js 0.0% -0.1% 6.96 KB 6.96 KB 2.62 KB 2.61 KB UMD_PROD
react-events-context-menu.development.js 0.0% -0.2% 2.67 KB 2.67 KB 1001 B 999 B UMD_DEV
react-events-input.development.js 0.0% -0.1% 4.51 KB 4.51 KB 1.44 KB 1.44 KB UMD_DEV
react-events-swipe.development.js 0.0% -0.1% 5.99 KB 5.99 KB 1.62 KB 1.62 KB UMD_DEV
react-events-context-menu.production.min.js 0.0% -0.1% 1.38 KB 1.38 KB 725 B 724 B UMD_PROD
react-events-input.production.min.js 0.0% -0.2% 1.83 KB 1.83 KB 979 B 977 B UMD_PROD
react-events-swipe.production.min.js 0.0% -0.2% 2.43 KB 2.43 KB 1.1 KB 1.1 KB UMD_PROD
ReactEventsTap-dev.js +7.2% +7.0% 15.92 KB 17.07 KB 3.48 KB 3.72 KB FB_WWW_DEV
ReactEventsTap-prod.js 🔺+8.3% 🔺+2.1% 12.93 KB 14 KB 2.89 KB 2.95 KB FB_WWW_PROD
react-events-context-menu.development.js 0.0% -0.2% 2.48 KB 2.48 KB 955 B 953 B NODE_DEV
react-events-input.development.js 0.0% -0.1% 4.33 KB 4.33 KB 1.39 KB 1.39 KB NODE_DEV
react-events-swipe.development.js 0.0% -0.1% 5.81 KB 5.81 KB 1.58 KB 1.58 KB NODE_DEV
react-events-context-menu.production.min.js 0.0% -0.2% 1.19 KB 1.19 KB 665 B 664 B NODE_PROD
react-events-input.production.min.js 0.0% -0.1% 1.65 KB 1.65 KB 911 B 910 B NODE_PROD
react-events-swipe.production.min.js 0.0% -0.1% 2.25 KB 2.25 KB 1.04 KB 1.04 KB NODE_PROD
react-events-hover.development.js 0.0% -0.1% 6.99 KB 6.99 KB 1.55 KB 1.55 KB UMD_DEV
react-events-scroll.development.js 0.0% -0.1% 6.29 KB 6.29 KB 1.65 KB 1.65 KB UMD_DEV
react-events-hover.production.min.js 0.0% -0.2% 3.11 KB 3.11 KB 1.13 KB 1.13 KB UMD_PROD
react-events-scroll.production.min.js 0.0% -0.3% 2.61 KB 2.61 KB 1.14 KB 1.14 KB UMD_PROD
react-events-hover.development.js 0.0% -0.1% 6.81 KB 6.81 KB 1.5 KB 1.5 KB NODE_DEV
react-events-scroll.development.js 0.0% -0.1% 6.11 KB 6.11 KB 1.6 KB 1.6 KB NODE_DEV
react-events-hover.production.min.js 0.0% -0.1% 2.93 KB 2.93 KB 1.07 KB 1.07 KB NODE_PROD
react-events-scroll.production.min.js 0.0% -0.2% 2.43 KB 2.43 KB 1.09 KB 1.08 KB NODE_PROD
react-events-focus.development.js 0.0% -0.1% 10.73 KB 10.73 KB 2.31 KB 2.31 KB NODE_DEV
react-events-press.development.js 0.0% -0.0% 20.51 KB 20.51 KB 4.77 KB 4.77 KB NODE_DEV
react-events-focus.production.min.js 0.0% -0.1% 3.92 KB 3.92 KB 1.32 KB 1.32 KB NODE_PROD
react-events-press.production.min.js 0.0% -0.1% 6.78 KB 6.78 KB 2.56 KB 2.56 KB NODE_PROD
react-events-drag.development.js 0.0% -0.1% 5.21 KB 5.21 KB 1.54 KB 1.54 KB UMD_DEV
react-events-keyboard.development.js 0.0% -0.1% 5.5 KB 5.5 KB 1.96 KB 1.96 KB UMD_DEV
react-events-tap.development.js +7.2% +6.7% 16.24 KB 17.41 KB 3.52 KB 3.76 KB UMD_DEV
react-events-drag.production.min.js 0.0% -0.3% 2.24 KB 2.24 KB 1.07 KB 1.07 KB UMD_PROD
react-events-tap.production.min.js 🔺+7.0% 🔺+2.5% 5.77 KB 6.17 KB 2.22 KB 2.28 KB UMD_PROD
react-events-drag.development.js 0.0% -0.0% 6.97 KB 6.97 KB 2.2 KB 2.2 KB NODE_DEV
react-events-keyboard.development.js 0.0% -0.1% 5.31 KB 5.31 KB 1.9 KB 1.9 KB NODE_DEV
react-events-tap.development.js +7.2% +6.8% 16.06 KB 17.22 KB 3.47 KB 3.71 KB NODE_DEV
react-events-drag.production.min.js 0.0% -0.1% 2.87 KB 2.87 KB 1.37 KB 1.37 KB NODE_PROD
react-events-keyboard.production.min.js 0.0% -0.1% 2.04 KB 2.04 KB 1.13 KB 1.13 KB NODE_PROD
react-events-tap.production.min.js 🔺+7.1% 🔺+2.6% 5.67 KB 6.07 KB 2.21 KB 2.26 KB NODE_PROD

Generated by 🚫 dangerJS against dca1a57

@trueadm
Copy link
Contributor

trueadm commented Sep 11, 2019

Changing the targetEventTypes to use click instead of click_active results in no click event being dispatched to onRootEvent, even though rootEventTypes contains click_active.

I can address this bug tomorrow. :)

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.

Looks good to me. I'll look into the bug you found with the target types tomorrow.

@necolas necolas force-pushed the react-events/tap-supports-virtual-click branch from b1fd4fe to dca1a57 Compare September 12, 2019 01:24
@necolas
Copy link
Contributor Author

necolas commented Sep 12, 2019

I tweaked the patch so that it doesn't need root click events.

I also realised that useKeyboard needs to call preventDefault() on click events that keyboard interactions might produce (e.g., on links), and that knowing when a "click" occurred might also be useful. Related, Microsoft added an onClick prop to RN's View specifically for keyboards. So I wonder if useKeyboard could add an onClick prop which could also be used to communicate back about these programmatic / screen-reader clicks instead of lumping that into Tap

@necolas
Copy link
Contributor Author

necolas commented Sep 16, 2019

Closed in favor of #16780

@necolas necolas closed this Sep 16, 2019
@necolas necolas deleted the react-events/tap-supports-virtual-click branch December 20, 2019 15:34
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