-
Notifications
You must be signed in to change notification settings - Fork 47k
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
[Umbrella] React Flare #15257
Comments
Behavior being tested takes cues from React Native's Pressability. A couple of these tests fail and require the Press implementation to be patched. Ref facebook#15257
Behavior being tested takes cues from React Native's Pressability. A couple of these tests fail and require the Press implementation to be patched. Ref facebook#15257
Behavior being tested takes cues from React Native's Pressability. A couple of these tests fail and require the Press implementation to be patched. Ref facebook#15257
Behavior being tested takes cues from React Native's Pressability. A couple of these tests fail and require the Press implementation to be patched. Ref facebook#15257
Added some proposed event object data. Suggest forwarding (or creating) the |
Hi guys. Great work! Will React.unstable_createEventComponent support observers api like ResizeObserver and IntersectionObserver? |
@TrySound Event responder modules are free to use whatever DOM APIs they want, so they could definitely use |
Question regarding potential scroll module - have you considered adding smth like |
What's an example of scroll being programmatically triggered without your knowledge? |
@necolas I feel like every change to |
But that's easy to detect because you're using a programmatic API |
It does get a bit difficult when the scrolling trigger is far from the listener, and making them aware of each other introduces fragile coupling. We've had a few such cases in DevTools. Especially if the focus signal is reactive to some state change. |
Here's what I ask: if you have a request please take the time to provide plenty of context. What are the use cases? How are things difficult? How do you imagine a solution might work? etc. |
In example showing a "sticker" with a date at the top of the message feed. When a scroll is induced programmatically (or by the browser) then it's distracting to show such thing, but when a user scrolls on their own it makes sense from the UX perspective.
Well, it's not a clear way of determining that in onScroll, so some kind of other tracking flags have to be introduced to solve this. It's in general tricky to handle all possible reasons of why scroll has been triggered:
And those are just things that user can do. Other than that UI might get mutated (even by React, so we can't really track it in userland) and thus trigger scroll event, and as @gaearon mentioned setting scrollTop also triggers scroll event. And even if u manage to track all reasons of user-induced scrolling it's unobvious when to clear you your flag(s) because you have to consider inertia scrolling etc
The solution would be to figure out best heuristics of detecting this. Can't give much detail right now, because this truly is an overcomplicated problem for such a "simple" thing. Web ❤️ |
I don't quite understand the use case you're describing. |
Consider another one - a floating "scroll to bottom" button which covers part of the chat feed. We'd like to show such when a user is scrolling on their own (with a delay etc) and hide it after they stop scrolling so we don't cover part of the chat feed constantly. And we i.e. have to work around for situations like mobile keyboard triggering onScroll (cause of the resize etc). |
Given the grand retooling happening to the event system here, I would like to re-raise the following request under this umbrella, from #3751 (comment): TL;DR: listen to
|
Hey guys, looks pretty cool this experimental event system. I wonder if there is still work to do, I would like to contribute to this. I see there are some pending tasks in the checklist but no open issues about them |
We're not longer working on this particular approach and will be exploring other ways to work with the DOM event system in the future. We've concluded that the "Flare" event system is too high-level an abstraction and we'd like to explore something that is a bit more familiar to developers familiar with the DOM (e.g., addEventListener) and React's existing tools (e.g., hooks). Our goal is still to make it possible for library authors to work with passive events, capture/bubble phase, custom events, and events occurring on the document from within a React function component...while reducing the amount of event-related code needed in ReactDOM. Ultimately building both intermediate abstractions like the Responder Event system and high-level abstractions like |
That's a bummer - this API looked awesome and I had high hopes for it. I guess you have good reasons for not pursuing this, I'm eager to learn with what alternative you will come up with. |
This issue tracks tasks related to the React DOM implementation of the experimental React Events API (
react-events
) aka React Flare (our internal code-name for the project). The idea is to extend React's event system to include high-level events that allow for consistent cross-device and cross-platform behavior.Note: For now this is completely experimental and won't affect the open source builds of React.
Core
timeStamp
. Should we provide a standard way to derive data that might be common across events and require different logic for different positional information, e.g., point, delta, offset, etc?React.unstable_createEventComponent(type: Symbol | number, responder: ReactEventResponder, displayName: ?string)
listener
from event object passed to callbacks likeonPress
Ownership
onStartShouldSetResponder
andonMoveShouldSetResponder
.Focus module
focusin
andfocusout
events.focusVisible
functionalityHover module
delayHoverStart
anddelayHoverEnd
props.onHoverStart
,onHoverEnd
.Press module
onMoveShouldEndPress
?onPressStart/Change
to be called, even thought those events are dispatched to the core responder system. (Event API: Fix bug where Press root events were not being cleared #15507)touchAction:'none'
is needed oncurrentTarget
to prevent browser cancelling afterpointermove
.pressRetentionOffset
to control when press is released after moving the pointer away from the press target.onPressStart
,onPressEnd
(Rename press props in experimental event API #15263).longPressCancelsPress
toonLongPressShouldCancelPress
(Rename press props in experimental event API #15263).delayLongPress
to 500ms (see note in Add tests for Press responder event module #15290)delayPressStart
anddelayPressEnd
props.fix keyboard press events when metaKey is involved(this currently works the same way as native, so will leave it for now)FocusScope module
Consider adding
onFocusIn
andonFocusOut
(names tbd) to support userland customisation of focus repair. We could return the native elements.A use case to consider: being able to programmatically move focus to an element without
allowing keyboards to focus the element (e.g., the document body, the root of a modal). In this
case the element (other than a few special cases) must have
tabIndex={-1}
.InputScope module
onChange
fires when an input element has been changed. This applies to<input>
,<textarea>
,<select>
and elements withcontenteditable
or whendesignMode
is enabled.onChange
provides a callback with the event for the element that changed and akey
of the elment that changed (if akey
was supplied).onValueChange
is similar toonChange
, but only provides the value changed. This applies to<input>
,<textarea>
,<select>
and elements withcontenteditable
or whendesignMode
is enabled.onValueChange
provides avalue
andkey
of the element that changed (if akey
was supplied).onSubmit
for when any<form>
elements trigger form submit.onKeyPress
for when any keyboard keys are pressed.preventKeys
accepts an array of key strings that will get prevented from entering input.onSelectionChange
for when any any text selection occurs in any child elements.onBeforeChange
fires before a change is about to occur. This applies to<input>
,<textarea>
,<select>
and elements withcontenteditable
or whendesignMode
is enabled.onBeforeChange
provides a callback with the event for the element that changed and akey
of the elment that changed (if akey
was supplied).Drag module
touchAction:'none'
is needed oncurrentTarget
to prevent browser cancelling afterpointermove
.mousemove
withdisplay:flex
.Pan module
touchAction:'none'
is needed oncurrentTarget
to prevent browser cancelling afterpointermove
.Scroll module
disabled
onScroll
onScrollDragStart
onScrollDragEnd
onMomentumScrollStart
onMomentumScrollEnd
Swipe module
onSwipe{Left,Right,Up,Down}
intoonSwipe
w/ event data.touchAction:'none'
is needed oncurrentTarget
to prevent browser cancelling afterpointermove
.Touch HitSlop
Consider whether we need this at all. Some browsers have a native hitslop and we could work with vendors on any potential improvements to the native system
position
parent of hitslop.touchHitSlop
(Add event touch hit target hit slop logic to experimental event API #15261).touchHitSlop
SSR supportDev Tools (#15267)
displayName
fields to event components and event targets.description
ordisplayName
field to event responders? For example thePress
responder module for ReactDOM could have the nameReactDOMPressResponder
.HoverEventResponder.DevToolEvents = [{ name: 'hover', trigger: [{ name: 'pointerup', passive: false }]];
Ancillary work
input
,textarea
,select
, etc.The text was updated successfully, but these errors were encountered: