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

In native code, there is no way to determine unset selected vs selected: false #46988

Open
chiaramooney opened this issue Oct 11, 2024 · 7 comments
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. p: Microsoft Partner: Microsoft Partner

Comments

@chiaramooney
Copy link
Contributor

chiaramooney commented Oct 11, 2024

Description

From the JS, the developer has the choice to specify the accessibilityState prop. Then, they can specify any subset of 'busy', 'expanded', 'selected', 'disabled', and 'checked'.

In the JS `selected' can be undefined or a boolean value. However, once the data is passed to the native code, accessibilityState->selected always takes a boolean value. There is no way to determine in the native code if the user has not set the 'selected' state (i.e. the control does not have selectable behavior) or if they have set 'selected' to false (i.e. the control does have selectable behavior but it is not selected)

Could we change the 'selected' value in the accessibilityState to be an std::optional, so the 'undefined' state of selected could be preserved on the native side? This change is needed to implement correct accessibility behavior on Windows.

Steps to reproduce

Set a control to have accessibilityState={{}} and accessibilityState={{selected: false}}. Both show the same data for props->accessibilityState

React Native Version

nightly

Affected Platforms

Other (please specify)

Output of npx react-native info

N/A

Stacktrace or Logs

N/A

Reproducer

https://snack.expo.dev/5HM2iIVtfaUY5z1FeHDgm

Screenshots and Videos

No response

@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. labels Oct 11, 2024
@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
Copy link
Collaborator

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

@chiaramooney chiaramooney changed the title In native code, there is no way to determine if the developer In native code, there is no way to determine unset selected vs selected: false Oct 11, 2024
@chiaramooney
Copy link
Contributor Author

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

https://snack.expo.dev/5HM2iIVtfaUY5z1FeHDgm

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

@chiaramooney Is this issue happening only on Windows? Or is it consistent across platforms?

@cortinico cortinico added p: Microsoft Partner: Microsoft Partner labels Oct 14, 2024
@chiaramooney
Copy link
Contributor Author

@shubhamguptadream11 Consistent across platforms!

@cortinico cortinico added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Attention Issues where the author has responded to feedback. labels Oct 15, 2024
@dnhan1707
Copy link

dnhan1707 commented Oct 29, 2024

Hi @chiaramooney , I'm would love to tackle this issue.
I already took a look at the code base and found that changing the type of selected to be std::optional with default is std::nullopt should be an easy fix.
However, what come to my mind is having another attribute to it called selectable with boolean type, but that will be more work to do. Let me know what do you think?

@chiaramooney
Copy link
Contributor Author

Great thank you!

The first option you presented of moving the type to be std::optional would be great. This way selected follows the same behavior convention as expanded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. p: Microsoft Partner: Microsoft Partner
Projects
None yet
Development

No branches or pull requests

5 participants