Skip to content

Event API: adds pointerType to Focus events#15645

Merged
trueadm merged 2 commits intofacebook:masterfrom
trueadm:focus-pointer-type
May 14, 2019
Merged

Event API: adds pointerType to Focus events#15645
trueadm merged 2 commits intofacebook:masterfrom
trueadm:focus-pointer-type

Conversation

@trueadm
Copy link
Copy Markdown
Contributor

@trueadm trueadm commented May 14, 2019

This PR is a follow up from the ideas in #15634. Specifically, rather than create a new type of event, this PR adds a new pointerType property to all Focus responder module events. This field lets the user know what type of input device was used to trigger a focus – touch, pen, mouse and keyboard.

@sizebot
Copy link
Copy Markdown

sizebot commented May 14, 2019

Details of bundled changes.

Comparing: cc24d0e...f2536bf

react-events

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-events.development.js 0.0% +0.3% 1.31 KB 1.31 KB 706 B 708 B UMD_DEV
react-events.production.min.js 0.0% 🔺+0.2% 682 B 682 B 430 B 431 B UMD_PROD
react-events.development.js 0.0% +0.3% 1.12 KB 1.12 KB 644 B 646 B NODE_DEV
react-events.production.min.js 0.0% 🔺+0.6% 512 B 512 B 352 B 354 B NODE_PROD
react-events-press.development.js 0.0% +0.1% 20.39 KB 20.39 KB 4.61 KB 4.61 KB UMD_DEV
react-events-press.production.min.js 0.0% 🔺+0.1% 7.62 KB 7.62 KB 2.64 KB 2.64 KB UMD_PROD
react-events-press.development.js 0.0% +0.1% 20.21 KB 20.21 KB 4.55 KB 4.55 KB NODE_DEV
react-events-press.production.min.js 0.0% 🔺+0.1% 7.44 KB 7.44 KB 2.59 KB 2.59 KB NODE_PROD
react-events-hover.development.js 0.0% +0.1% 8.49 KB 8.49 KB 2.07 KB 2.07 KB UMD_DEV
react-events-hover.production.min.js 0.0% 🔺+0.1% 3.64 KB 3.64 KB 1.34 KB 1.34 KB UMD_PROD
react-events-hover.development.js 0.0% +0.1% 8.3 KB 8.3 KB 2.02 KB 2.02 KB NODE_DEV
react-events-hover.production.min.js 0.0% 🔺+0.2% 3.47 KB 3.47 KB 1.29 KB 1.29 KB NODE_PROD
react-events-focus.development.js +16.4% +12.0% 6.06 KB 7.05 KB 1.58 KB 1.77 KB UMD_DEV
react-events-focus.production.min.js 🔺+12.5% 🔺+7.9% 2.71 KB 3.05 KB 1.06 KB 1.14 KB UMD_PROD
react-events-focus.development.js +16.9% +13.3% 5.87 KB 6.86 KB 1.52 KB 1.72 KB NODE_DEV
react-events-focus.production.min.js 🔺+13.9% 🔺+10.4% 2.52 KB 2.87 KB 994 B 1.07 KB NODE_PROD
ReactEventsFocus-dev.js +17.8% +14.3% 5.88 KB 6.93 KB 1.52 KB 1.74 KB FB_WWW_DEV
ReactEventsFocus-prod.js 🔺+21.1% 🔺+14.0% 5.04 KB 6.11 KB 1.22 KB 1.4 KB FB_WWW_PROD
react-events-focus-scope.development.js 0.0% +0.1% 4.72 KB 4.72 KB 1.41 KB 1.41 KB UMD_DEV
react-events-focus-scope.production.min.js 0.0% 🔺+0.3% 1.96 KB 1.96 KB 976 B 979 B UMD_PROD
react-events-focus-scope.development.js 0.0% +0.1% 4.54 KB 4.54 KB 1.35 KB 1.35 KB NODE_DEV
react-events-focus-scope.production.min.js 0.0% 🔺+0.2% 1.77 KB 1.77 KB 890 B 892 B NODE_PROD
react-events-swipe.development.js 0.0% +0.1% 6.17 KB 6.17 KB 1.74 KB 1.74 KB UMD_DEV
react-events-swipe.production.min.js 0.0% 🔺+0.1% 2.66 KB 2.66 KB 1.24 KB 1.24 KB UMD_PROD
react-events-swipe.development.js 0.0% 0.0% 7.93 KB 7.93 KB 2.39 KB 2.39 KB NODE_DEV
react-events-swipe.production.min.js 0.0% 🔺+0.1% 3.3 KB 3.3 KB 1.52 KB 1.52 KB NODE_PROD
react-events-drag.development.js 0.0% +0.1% 5.72 KB 5.72 KB 1.62 KB 1.62 KB UMD_DEV
react-events-drag.production.min.js 0.0% 🔺+0.2% 2.52 KB 2.52 KB 1.15 KB 1.15 KB UMD_PROD
react-events-drag.development.js 0.0% 0.0% 7.47 KB 7.47 KB 2.28 KB 2.28 KB NODE_DEV
react-events-drag.production.min.js 0.0% 🔺+0.1% 3.16 KB 3.16 KB 1.45 KB 1.45 KB NODE_PROD

Generated by 🚫 dangerJS

Comment thread packages/react-events/src/Focus.js
Comment thread packages/react-events/src/Focus.js Outdated
@trueadm trueadm merged commit af19e2e into facebook:master May 14, 2019
@Andarist
Copy link
Copy Markdown
Contributor

Is this a good name for this property? Keyboard is actually not considered to be a pointer device by various HTML etc APIs. Including this one https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType

@@ -249,6 +305,7 @@ const FocusResponder = {
nativeEvent.key === 'Tab' &&
!(nativeEvent.metaKey || nativeEvent.altKey || nativeEvent.ctrlKey)
) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Im wondering if this is a correct condition. MacOS (and therefore Safari) wont focus i.e. radios and checkboxes on Tab alone. U need to press down Tab+Alt for that

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.

6 participants