Commit Graph
160 Commits
Author SHA1 Message Date
Nicolas GallagherandGitHub 9449f8bf39 [react-events] Fix keyboard responder test (#16368) 2019-08-12 13:51:00 -07:00
Nicolas GallagherandGitHub 107521a952 [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 07a02fb80d [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 d9fdec6cfe [Flare] Remove contextmenu logic from Press (#16322) 2019-08-08 21:42:01 +01:00
Nicolas GallagherandGitHub ed49700796 [react-events] Separate the Focus/FocusWithin unit tests (#16298) 2019-08-06 09:16:21 -07:00
Nicolas GallagherandGitHub 23405c9c4c [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 42794557ca [Flare] Tweaks to Flare system design and API (#16264) 2019-08-01 19:08:54 +01:00
Dominic GannawayandGitHub b5af4fe3c6 Remove FocusScope (#16267) 2019-07-31 17:40:11 +01:00
Nicolas GallagherandGitHub e276a5e850 [Flare] Remove delay props from Hover (#16248)
Moving working with delays into user-space.
2019-07-30 09:29:43 -07:00
Nicolas GallagherandGitHub 1912b4a0f1 [Flare] Remove delay props from Press (#16247)
Moving working with delays into user-space.
2019-07-30 09:29:26 -07:00
Nicolas GallagherandGitHub 47656bf2a1 [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 e0472709c8 [Flare] Adds Keyboard event responder (#16204) 2019-07-25 17:47:44 +01:00
Dominic GannawayandGitHub 5098891193 [Flare] Redesign core event system (#16163) 2019-07-23 23:46:44 +01:00
Nicolas GallagherandGitHub bbd21066e6 [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 783b8f4ae1 [Flare] Ensure mouse events can use target to validate press (#16172) 2019-07-22 12:31:19 +01:00
Nicolas GallagherandGitHub 997154bcc7 [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 65b80fdd94 [Flare] Add Input event responder surface (#16148) 2019-07-17 21:04:41 +01:00
Nicolas GallagherandGitHub ca4d78f9b6 [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 2073a7144e [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 23b8a25345 [Flare] Remove responder flags to simplify logic (#16084) 2019-07-09 15:05:45 +01:00
Dominic GannawayandGitHub 2253bc81d0 [Flare] Switch from currentTarget model to responderTarget model (#16082) 2019-07-08 17:03:15 +01:00
Dominic GannawayandGitHub 67e3f3fb6e [Flare] Revise responder event types (#16081) 2019-07-08 14:35:59 +01:00
Dominic GannawayandGitHub aa519c17cc [Flare] Add currentTarget and unify RN and DOM codepaths (#16066) 2019-07-08 11:50:21 +01:00
Vincent RiemerandDominic Gannaway bd72b04939 [Flare] Clear pressStart timeout on pointercancel (#16067) 2019-07-05 11:45:33 +01:00
Dominic GannawayandGitHub c40075a72c [Flare] Remove capture phase Flare events (#16054) 2019-07-04 21:30:46 +01:00
Dominic GannawayandGitHub 786186c692 [Flare] createInitialState -> getInitialState (#16051) 2019-07-04 18:06:18 +01:00
Dominic GannawayandGitHub 6b946ad9da [Flare] Add more functionality to Scroll event resonder (#16036) 2019-07-02 23:51:31 +01:00
Dominic GannawayandGitHub 6cf2234a57 [Flare] Do not block mouse presses on scroll (#16033) 2019-07-02 16:58:46 +01:00
Dominic GannawayandGitHub eb2ace1281 [Flare] Bring Flare support to React Native Fabric (#15887) 2019-06-28 01:22:32 +01:00
Dominic GannawayandGitHub 9b0bd43550 [Flare] Re-label Flare flag (#16014) 2019-06-28 01:11:11 +01:00
Dominic GannawayandGitHub 8b88ac2592 [Flare] Remove event targets including TouchHitTarget (#16011) 2019-06-27 23:58:48 +01:00
Dominic GannawayandGitHub 824e9bec7a [Flare] Fix issues with touch + pointer interactions (#15997) 2019-06-26 22:25:49 +01:00
Dominic GannawayandGitHub dd93357aa0 [Flare] Move click handling back into target phase (#15993) 2019-06-26 20:44:44 +01:00
Andrew ClarkandGitHub 4d307de458 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 9b55bcfc6b [Flare] Add Hooks to event modules (#15953) 2019-06-26 08:47:21 +01:00
Dominic GannawayandGitHub 6088a201e1 [Flare] Fix Press scroll cancellation handling (#15983) 2019-06-25 14:31:48 +01:00
Dominic GannawayandGitHub fd601fb219 [Flare] Move all event responders to dom directory (#15981) 2019-06-25 09:32:20 +01:00
Dominic GannawayandGitHub 20f3546963 [Flare] Ensure Press event hook does not execute side-effects (#15976) 2019-06-24 18:31:49 +01:00
Dominic GannawayandGitHub 34ce57ae75 [Flare] Refine flow type annotations (#15950) 2019-06-21 12:32:43 +01:00
Dominic GannawayandGitHub 4f92fbce5c [Flare] Move createEvent back to React object (#15943) 2019-06-21 10:12:56 +01:00
Dominic GannawayandAndrew Clark 720db4cbe6 [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 6ff4c9de1c [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 5368f7316c [Flare] Fix keyboard keyup regression (#15938) 2019-06-20 17:00:09 +01:00
Dominic GannawayandGitHub e61c9e0a26 [Flare] Fix Press retention state regression (#15936) 2019-06-20 13:01:56 +01:00
Dominic GannawayandGitHub b62ae16429 [Flare] Rename createEventComponent -> createEvent (#15929) 2019-06-19 21:12:14 +01:00
Nicolas GallagherandGitHub f4e1ac8caf [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 689beef6f5 [Flare] Move unstable_createEventComponent to ReactDOM (#15890) 2019-06-18 23:41:00 +01:00
Nicolas GallagherandGitHub f97b951666 [Flare] add disableContextMenu to Press (#15909) 2019-06-18 11:34:34 -07:00
Dominic GannawayandGitHub 353e0ee474 [Flare] remove stopLocalPropagation option + modify responder ownership (#15889) 2019-06-14 23:11:54 +01:00
Dominic GannawayandGitHub a146c1f9ed [Flare] Refactor of Press to fix various issues (#15878) 2019-06-14 22:52:26 +01:00