You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We expose AccessibilityDelegate method callbacks in LayoutSpecs as event handlers. However, we're missing getAccessibilityNodeProvider. Proper implementations of node providers can be very stateful since they need to handle hover callbacks. In order to make this as stateless as possible and play nice with the framework, there are two possibilities:
Do not expose the creation of the AccessibilityNodeInfoProviderCompat object directly, instead expose its API as event handlers.
Leverage the fact that ComponentAccessibilityDelegate extends ExploreByTouchHelper and expose its virtual view related abstract methods as event handlers. This would also require that we make sure that the dispatchHoverEvent callback is extended to arbitrary views and not just ComponentHost
Regardless of which idea we choose, there are a couple of things to consider:
We should default to returning null in getAccessibilityNodeProvider. Returning a non-null value changes how/whether certain accessibility events are routed to the right callbacks
MountSpecs that implement virtual view hierarchies, require we return a special node provider. If no event handler for node provider is set on the LayoutSpec, we should respect the MountSpec's original behavior, otherwise, we should override it. See ComponentAccessibilityDelegate#onInitializeAccessibilityNodeInfo for an example.
We expose
AccessibilityDelegate
method callbacks inLayoutSpecs
as event handlers. However, we're missinggetAccessibilityNodeProvider
. Proper implementations of node providers can be very stateful since they need to handle hover callbacks. In order to make this as stateless as possible and play nice with the framework, there are two possibilities:AccessibilityNodeInfoProviderCompat
object directly, instead expose its API as event handlers.ComponentAccessibilityDelegate
extendsExploreByTouchHelper
and expose its virtual view related abstract methods as event handlers. This would also require that we make sure that thedispatchHoverEvent
callback is extended to arbitrary views and not justComponentHost
Regardless of which idea we choose, there are a couple of things to consider:
getAccessibilityNodeProvider
. Returning a non-null value changes how/whether certain accessibility events are routed to the right callbacksMountSpecs
that implement virtual view hierarchies, require we return a special node provider. If no event handler for node provider is set on theLayoutSpec
, we should respect theMountSpec
's original behavior, otherwise, we should override it. SeeComponentAccessibilityDelegate#onInitializeAccessibilityNodeInfo
for an example.Code pointers
https://github.com/facebook/litho/blob/master/litho-core/src/main/java/com/facebook/litho/ComponentAccessibilityDelegate.java#L62
Point of contact: @muraziz
The text was updated successfully, but these errors were encountered: