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] Support screen reader virtual clicks #16584

Merged
merged 3 commits into from
Aug 27, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Aug 27, 2019

This PR aims to address issues around using screen reader tooling (VoiceOver, NVDA, JAWS) with the Press event responder. We previously relied on "press" events firing when coming from a valid pointer/mouse/touch sequence of events. We also supported "Enter" and "Space" keyboard events. However, we did not take into account that screen reader tooling can also fire virtual click events to specific DOM nodes.

Screen reader virtual click events have a pattern that makes them somewhat easy to detect. They seem to also have 0 as the nativeEvent.detail, rather than 1 and they also never provide screen co-ordinates (they are all always 0).

Testing URL: https://m9zxnyvpj9.csb.app/

@sizebot
Copy link

sizebot commented Aug 27, 2019

Details of bundled changes.

Comparing: 0da7bd0...7a8b04f

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.9 KB 10.9 KB 2.35 KB 2.35 KB UMD_DEV
react-events-press.development.js +3.5% +4.3% 20.37 KB 21.08 KB 4.76 KB 4.96 KB UMD_DEV
react-events-focus.production.min.js 0.0% 🔺+0.1% 4.08 KB 4.08 KB 1.38 KB 1.38 KB UMD_PROD
react-events-press.production.min.js 🔺+2.5% 🔺+1.6% 6.84 KB 7 KB 2.58 KB 2.62 KB UMD_PROD
react-events-context-menu.development.js 0.0% +0.2% 2.67 KB 2.67 KB 998 B 1000 B UMD_DEV
react-events-input.development.js 0.0% +0.2% 4.52 KB 4.52 KB 1.43 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.3% 1.38 KB 1.38 KB 723 B 725 B UMD_PROD
react-events-input.production.min.js 0.0% 🔺+0.2% 1.82 KB 1.82 KB 970 B 972 B UMD_PROD
react-events-context-menu.development.js 0.0% +0.1% 2.48 KB 2.48 KB 953 B 954 B NODE_DEV
react-events-input.development.js 0.0% +0.1% 4.33 KB 4.33 KB 1.38 KB 1.39 KB NODE_DEV
react-events-context-menu.production.min.js 0.0% 🔺+0.2% 1.19 KB 1.19 KB 663 B 664 B NODE_PROD
react-events-input.production.min.js 0.0% 🔺+0.1% 1.64 KB 1.64 KB 904 B 905 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.98 KB 6.98 KB 1.54 KB 1.55 KB UMD_DEV
react-events-hover.production.min.js 0.0% 🔺+0.1% 3.1 KB 3.1 KB 1.12 KB 1.12 KB UMD_PROD
react-events-scroll.production.min.js 0.0% 🔺+0.1% 2.61 KB 2.61 KB 1.14 KB 1.14 KB UMD_PROD
react-events-hover.development.js 0.0% +0.1% 6.8 KB 6.8 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-scroll.production.min.js 0.0% 🔺+0.1% 2.43 KB 2.43 KB 1.08 KB 1.08 KB NODE_PROD
react-events-focus.development.js 0.0% +0.1% 10.72 KB 10.72 KB 2.31 KB 2.31 KB NODE_DEV
react-events-press.development.js +3.5% +4.3% 20.19 KB 20.9 KB 4.71 KB 4.91 KB NODE_DEV
react-events-focus.production.min.js 0.0% 🔺+0.1% 3.91 KB 3.91 KB 1.31 KB 1.31 KB NODE_PROD
react-events-press.production.min.js 🔺+2.5% 🔺+1.6% 6.66 KB 6.83 KB 2.52 KB 2.56 KB NODE_PROD
react-events-drag.development.js 0.0% +0.1% 5.21 KB 5.21 KB 1.53 KB 1.54 KB UMD_DEV
react-events-drag.production.min.js 0.0% 🔺+0.2% 2.24 KB 2.24 KB 1.07 KB 1.07 KB UMD_PROD
ReactEventsPress-dev.js +3.4% +4.4% 20.96 KB 21.68 KB 4.88 KB 5.1 KB FB_WWW_DEV
ReactEventsPress-prod.js 🔺+2.9% 🔺+1.5% 15.64 KB 16.09 KB 3.48 KB 3.53 KB FB_WWW_PROD
react-events-keyboard.production.min.js 0.0% -0.1% 1.69 KB 1.69 KB 961 B 960 B NODE_PROD

Generated by 🚫 dangerJS

@trueadm trueadm merged commit 4ef2696 into facebook:master Aug 27, 2019
@trueadm trueadm deleted the screenreader-click branch August 27, 2019 16:32
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.

None yet

4 participants