Commit Graph
160 Commits
Author SHA1 Message Date
Nicolas GallagherandGitHub e71f050273 [react-events] Fix keyboard responder test (#16368) 2019-08-12 13:51:00 -07:00
Nicolas GallagherandGitHub dde9dedfc8 [react-events] Focus/FocusWithin responders with fallbacks (#16343)
Separate the PointerEvent and fallback implementations.
Fix the unit tests to cover both PointerEvent and non-PointerEvent environments.
Fix the focus-visible related callbacks to get called when keys other than "Tab" are used.
2019-08-12 10:10:51 -07:00
Nicolas GallagherandGitHub 6989d56eec [react-events] Refactor unit tests for Hover (#16320)
**Problem**

The existing responders listen to pointer events by default and add fallback events if PointerEvent is not supported. However, this complicates the responders and makes it easy to create a problematic unit test environment. jsdom doesn't support PointerEvent, which means that the responders end up listening to pointer events *and* fallback events in unit tests. This isn't a direct problem in production environments, because no browser will fire pointer events if they aren't supported. But in the unit test environment, we often dispatch event sequences taken from browsers that support pointer events. This means that what we're often testing is actually a (complex) scenario that cannot even occur in production: a responder that is listening to and receives both pointer events and fallback events. Not only does this risk making responders more complicated to implement but it could also hide bugs in implementations.

**Response**

Implement the responders so that they're only listening to *either* pointer events *or* fallback events, never both. This should make the default pointer events implementations significantly simpler and easier to test, as well as free to rely on the complete PointerEvents API. In the future it should also make DCE easier for target environments that are known to support PointerEvents, as we can use build tools with an equivalent of the runtime check. The fallback events (touch and mouse) need to coexist and be resilient to browser emulated events. Our unit tests should express a suite of high-level interactions that can be run in environments with and without PointerEvents support.
2019-08-09 10:53:49 -07:00
Dominic GannawayandGitHub c4da503ad5 [Flare] Remove contextmenu logic from Press (#16322) 2019-08-08 21:42:01 +01:00
Nicolas GallagherandGitHub 65460b0cd1 [react-events] Separate the Focus/FocusWithin unit tests (#16298) 2019-08-06 09:16:21 -07:00
Nicolas GallagherandGitHub 9d533bce1f [react-events] Add ContextMenu responder (#16296)
A module for responding to contextmenu events. This functionality will be
removed from the Press responder in the future.
2019-08-06 09:16:05 -07:00
Dominic GannawayandGitHub 520fc34334 [Flare] Tweaks to Flare system design and API (#16264) 2019-08-01 19:08:54 +01:00
Dominic GannawayandGitHub f9c07431fa Remove FocusScope (#16267) 2019-07-31 17:40:11 +01:00
Nicolas GallagherandGitHub c3125cbaac [Flare] Remove delay props from Hover (#16248)
Moving working with delays into user-space.
2019-07-30 09:29:43 -07:00
Nicolas GallagherandGitHub 9ea8e8a77b [Flare] Remove delay props from Press (#16247)
Moving working with delays into user-space.
2019-07-30 09:29:26 -07:00
Nicolas GallagherandGitHub 1f81664bbc [Flare] Remove longpress from press responder (#16242)
Long press will move to a separate responder.
2019-07-29 13:12:12 -07:00
Dominic GannawayandGitHub 73f34c118a [Flare] Adds Keyboard event responder (#16204) 2019-07-25 17:47:44 +01:00
Dominic GannawayandGitHub 44acf39c90 [Flare] Redesign core event system (#16163) 2019-07-23 23:46:44 +01:00
Nicolas GallagherandGitHub 1aae96eac5 [Flare] Press: fix keyboard interactions (#16179)
Prevents Spacebar from scrolling the window.
Prevents Enter from triggering a navigation if preventDefault is true.
Fixes the emulated mouse events test.
2019-07-22 18:16:40 -07:00
Dominic GannawayandGitHub 995b710b2e [Flare] Ensure mouse events can use target to validate press (#16172) 2019-07-22 12:31:19 +01:00
Nicolas GallagherandGitHub 64b0cb7136 [Flare] Add FocusWithin responder (#16152)
FocusWithin is implemented as a separate responder, which keeps both focus
responders simple and allows for easier composition of behaviours.
2019-07-17 15:17:13 -07:00
Dominic GannawayandGitHub f34ff15961 [Flare] Add Input event responder surface (#16148) 2019-07-17 21:04:41 +01:00
Nicolas GallagherandGitHub 27b701945e [Flare] Press: fix middle-click handling (#16114)
Make sure the root events are removed after middle-click completes
2019-07-11 22:12:10 +01:00
Nicolas GallagherandGitHub 5a67c6a9a4 [Flare] Press includes button type (#16100)
1. Allow auxillary button clicks (i.e., middle mouse button) to trigger 'onPressStart' and 'onPressEnd', but never 'onPress'.
2. Report the button type – 'primary' or 'auxillary' – on the press event.
2019-07-10 17:52:10 +01:00
Dominic GannawayandGitHub 4e4bf7822a [Flare] Remove responder flags to simplify logic (#16084) 2019-07-09 15:05:45 +01:00
Dominic GannawayandGitHub f3a3a27a35 [Flare] Switch from currentTarget model to responderTarget model (#16082) 2019-07-08 17:03:15 +01:00
Dominic GannawayandGitHub 4e7f2c8f88 [Flare] Revise responder event types (#16081) 2019-07-08 14:35:59 +01:00
Dominic GannawayandGitHub c4eb79ad86 [Flare] Add currentTarget and unify RN and DOM codepaths (#16066) 2019-07-08 11:50:21 +01:00
Vincent RiemerandDominic Gannaway 4474118eda [Flare] Clear pressStart timeout on pointercancel (#16067) 2019-07-05 11:45:33 +01:00
Dominic GannawayandGitHub 54a79bf26b [Flare] Remove capture phase Flare events (#16054) 2019-07-04 21:30:46 +01:00
Dominic GannawayandGitHub 815e342028 [Flare] createInitialState -> getInitialState (#16051) 2019-07-04 18:06:18 +01:00
Dominic GannawayandGitHub 00d0d2a629 [Flare] Add more functionality to Scroll event resonder (#16036) 2019-07-02 23:51:31 +01:00
Dominic GannawayandGitHub 3faa1769e2 [Flare] Do not block mouse presses on scroll (#16033) 2019-07-02 16:58:46 +01:00
Dominic GannawayandGitHub 64f10bc939 [Flare] Bring Flare support to React Native Fabric (#15887) 2019-06-28 01:22:32 +01:00
Dominic GannawayandGitHub dbbc87e57d [Flare] Re-label Flare flag (#16014) 2019-06-28 01:11:11 +01:00
Dominic GannawayandGitHub b089e50037 [Flare] Remove event targets including TouchHitTarget (#16011) 2019-06-27 23:58:48 +01:00
Dominic GannawayandGitHub 3995f2a2d2 [Flare] Fix issues with touch + pointer interactions (#15997) 2019-06-26 22:25:49 +01:00
Dominic GannawayandGitHub 96f1358836 [Flare] Move click handling back into target phase (#15993) 2019-06-26 20:44:44 +01:00
Andrew ClarkandGitHub 12ded78ee5 Prefix mock Scheduler APIs with _unstable (#15999)
For now this is only meant to be consumed via `act`.
2019-06-26 12:16:08 -07:00
Brandon DailandDominic Gannaway d149fc6048 [Flare] Add Hooks to event modules (#15953) 2019-06-26 08:47:21 +01:00
Dominic GannawayandGitHub 75ee8176f3 [Flare] Fix Press scroll cancellation handling (#15983) 2019-06-25 14:31:48 +01:00
Dominic GannawayandGitHub 87fbefaed1 [Flare] Move all event responders to dom directory (#15981) 2019-06-25 09:32:20 +01:00
Dominic GannawayandGitHub 4b59e7f212 [Flare] Ensure Press event hook does not execute side-effects (#15976) 2019-06-24 18:31:49 +01:00
Dominic GannawayandGitHub 3ae909dcd4 [Flare] Refine flow type annotations (#15950) 2019-06-21 12:32:43 +01:00
Dominic GannawayandGitHub 118199afa2 [Flare] Move createEvent back to React object (#15943) 2019-06-21 10:12:56 +01:00
Dominic GannawayandAndrew Clark 498afc97c5 [Flare] Add useEvent hook implementation (#15927)
* [Flare] Add useEvent hook implementation

Validate hooks have decendent event components

Few fixes and displayName changes

Fix more responder bugs

Update error codes

* Add another test

* Address feedback
2019-06-20 19:12:40 -07:00
Nicolas GallagherandGitHub a77a3f38a0 [Flare] Press: fix stale deactivation region state (#15931)
The responder region calculation logic wasn't updating the deactivation region
during the lifetime of an event instance, causing incorrect behaviour when the
current press ends outside the press target and if the press target has moved
since the last time the first-and-only time the deactivation region was
measured.
2019-06-20 17:10:54 -07:00
Dominic GannawayandGitHub bec6986c09 [Flare] Fix keyboard keyup regression (#15938) 2019-06-20 17:00:09 +01:00
Dominic GannawayandGitHub 44ae5e0e7d [Flare] Fix Press retention state regression (#15936) 2019-06-20 13:01:56 +01:00
Dominic GannawayandGitHub bb1ce64fd4 [Flare] Rename createEventComponent -> createEvent (#15929) 2019-06-19 21:12:14 +01:00
Nicolas GallagherandGitHub 4ab7755ac4 [Flare] Press events include defaultPrevented (#15916)
* Rename `disableContextMenu` to `preventContextMenu`
* Change the behaviour of `preventContextMenu` so that `onContextMenu` is still called when the native context menu is prevented.
2019-06-19 11:00:44 -07:00
Dominic GannawayandGitHub f01586ec26 [Flare] Move unstable_createEventComponent to ReactDOM (#15890) 2019-06-18 23:41:00 +01:00
Nicolas GallagherandGitHub e62c014a8a [Flare] add disableContextMenu to Press (#15909) 2019-06-18 11:34:34 -07:00
Dominic GannawayandGitHub 5a9b7905bd [Flare] remove stopLocalPropagation option + modify responder ownership (#15889) 2019-06-14 23:11:54 +01:00
Dominic GannawayandGitHub 5ba77153c7 [Flare] Refactor of Press to fix various issues (#15878) 2019-06-14 22:52:26 +01:00