Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implement UIA Invoke Method #11874
Implement UIA Invoke Method #11874
Changes from 5 commits
2f77b71
e0779e4
ddad53f
da2dbbd
50a5e90
e39a92d
352b505
2c1bcc9
10b6a31
c80f7bc
223257c
50d480a
c2d7e04
2680a00
57fe0ba
b41a392
f44b187
82749ed
b7fd10f
83e4197
1497fec
beaab47
4d84bd8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do wonder if this is correct? What if we have some special code that needs to behave differently for pointer and AT users? (e.g. Telemetry recording invocation method).
I feel like if both are implemented, maybe we should only call onAccessibilityTap and rely on users to handle the normal onClick behavior in the JS callback. Or maybe both? Maybe this was already discussed with the Paper impl, but I don't know that I like the idea that we deprive people of an AT-specific code path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure! Just to confirm I understand what you're saying, you're wondering that maybe the behavior we had on Paper was wrong. And that instead we should either...
(1) always call onAccessibilityTap
(2) always call both onAccessibilityTap and onClick
That makes sense to me! It did seem odd that the onAccessibilityTap functionality would be ignored when onClick functionality is set. Option 2 seems like the right option to me, do you have an instinct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked and this:
is what we do in Office, though I do want to get this right. So while (2) sounds reasonable, I wouldn't mind a second opinion here from @jonthysell or @acoates-ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with (1). I dont see any indication in code that core calls onClick when invoking onAccessibilityTap. @Saadnajmi might be able to verify the behavior on iOS. (I think onClick might be fabric only in iOS)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that
onAccessibilityTap
is its own, independent event in RN code, and technically an iOS-only event (though not documented that way, see facebook/react-native#34136).See also https://reactnative.dev/docs/view#onaccessibilitytap
I think our Paper impl is too tied up with how we interacted with XAML and XAML's behaviors.
onClick
is a windows-only event, and I don't really like that we assume to send andonClick
when hit via UIA. Why not anonPress
? Nowhere do I see code that defaults to calling RN's own built-inonPress
during anonAccessibilityTap
.I'd rather leave that up to app devs in JS rather than assume a default behavior "by default". Every example online where I can find people who care about accessibility, they define both onPress and onAccessibilityTap (even if it's usually to the same function). If any particular dev wants it to pass through they can easily define their own JS components to do so.
That said, it appears in RN for iOS, there is a kind of event chaining where the 'activate' accessibilityAction presumes to call
onAccessibilityTap
if it's available:https://github.com/facebook/react-native/blob/8d8455c3c34e9554908781485718d8eee252267f/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm#L802-L810
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of additional pieces of info:
props->onClick
matches whetheronPress
has been set. And the call todispatchEvent("topClick")
runs theonPress
function. I haven't dug into the code to figure out why this is the case, but that's the behavior we get.onAccessibilityTap
is not set, then theonPress
function is run instead. The program simply does a noop. So if the Invoke method expects the behavior to match when you click without AT, then just callingonAccessibilityTap
might not be sufficient._props->onClick
to be called ifonAccessibilityTap
isn't implemented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it is a note to the developer that they should typically set
onAccessibilityTap
to the same value ofonClick
. Not that the platform would do it for you. If the platform does it, then it is no longer typically, but always, which could be problematic for some use cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that makes sense. Seems consensus is to only calling onAccessibilityTap. I'll make those edits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need a native onClick when Pressability is a thing
nowsince 0.63? https://reactnative.dev/docs/pressableMaybe we should just define onClick in the View js and have it pass through to onPress? Is that possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying note from above: The value of props->onClick matches whether onPress has been set. And the call to dispatchEvent("topClick") runs the onPress function. I haven't dug into the code to figure out why this is the case, but that's the behavior we get.
So we don't need to pass any additional props through on the JS side to get onClick data. This code is just to allow us to access the onPress data on the native side.