Skip to content
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

onAccessibilityTap does not work on Android #47149

Closed
Aksana-Tsishchanka opened this issue Oct 21, 2024 · 8 comments
Closed

onAccessibilityTap does not work on Android #47149

Aksana-Tsishchanka opened this issue Oct 21, 2024 · 8 comments
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications. Type: Unsupported Version Issues reported to a version of React Native that is no longer supported

Comments

@Aksana-Tsishchanka
Copy link

Description

The official documentation https://reactnative.dev/docs/0.72/accessibility#onaccessibilitytap does not have any platform specific label, however this method does not work on Android.
TS documentation in https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/View/ViewAccessibility.d.ts#L302 say it's IOS only.

But having accessibility actions for Android and IOS is extremely important feature. Could you please fix the issue.

Here the code that should call a provide callback on accessibility actions:

tech details:
I have the same issue with RN 0.72.6. Here is my code:

const a11yActions = [
{ name: 'add', label: 'Add the library' },
{ name: 'more', label: 'Open menu' },
]

<Pressable
accessibilityActions={a11yActions}
onAccessibilityTap={() => {
if (event.nativeEvent.actionName === 'add') {
firstButtonProps.onPress(event)
}
if (event.nativeEvent.actionName === 'more') {
secondButtonProps?.onPress(event)
}
}}

On Android when a screen reader is turn on, the bottom sheet with the defined actions appears but activation 'add' or 'more' does not call a provided callback.

Similar issue is reported here #34136

Steps to reproduce

const a11yActions = [
{ name: 'add', label: 'Add the library' },
{ name: 'more', label: 'Open menu' },
]

<Pressable
accessibilityActions={a11yActions}
onAccessibilityTap={() => {
if (event.nativeEvent.actionName === 'add') {
firstButtonProps.onPress(event)
}
if (event.nativeEvent.actionName === 'more') {
secondButtonProps?.onPress(event)
}
}}

On Android when a screen reader is turn on, the bottom sheet with the defined actions appears but activation 'add' or 'more' does not call a provided callback.

React Native Version

0.72.6

Affected Platforms

Runtime - Android

Output of npx react-native info

no run time issue, see details above

Stacktrace or Logs

no run time issue, see details above

Reproducer

x

Screenshots and Videos

No response

@react-native-bot react-native-bot added the Type: Unsupported Version Issues reported to a version of React Native that is no longer supported label Oct 21, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Unsupported Version of React Native
ℹ️ It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications. and removed Needs: Triage 🔍 labels Oct 21, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Unsupported Version of React Native
ℹ️ It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:

@Aksana-Tsishchanka
Copy link
Author

Seems the same issue is reproducible for the latest RN version

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Oct 21, 2024
@migueldaipre
Copy link
Collaborator

@Aksana-Tsishchanka Can you provide a reproducer? If possible in the latest version of react native

@migueldaipre migueldaipre added Needs: Author Feedback and removed Needs: Attention Issues where the author has responded to feedback. labels Oct 22, 2024
@Aksana-Tsishchanka
Copy link
Author

Hey there, I can reproduce it with the latest RN version. However, after reviewing the documentation I found that another property which is https://reactnative.dev/docs/0.72/accessibility#accessibility-actions do the same and work for Android. It might be worth to update the RN documentation for https://reactnative.dev/docs/0.72/accessibility#onaccessibilitytap clarify that it's only for IOS and how it differs from https://reactnative.dev/docs/0.72/accessibility#accessibility-actions

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Oct 28, 2024
@Aksana-Tsishchanka
Copy link
Author

I am closing the original issue, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications. Type: Unsupported Version Issues reported to a version of React Native that is no longer supported
Projects
None yet
Development

No branches or pull requests

3 participants