-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix accessibilityState to support states not being set #11792
Conversation
Our existing implementation for `accessibilityState` does not support that the values of a state can be `null`. This means *every* View has *every* unset state with the default `false` value. The problem stems from implementing the short-lived `accessibilityStates` prop at the same time. This PR fixes our implementation to only include the states when explicitly set. Resolves microsoft#11791
Need to get XamlTreeDump updated to test this properly, see asklar/XamlTreeDump#10 |
…anup This PR accomplishes several tasks to refresh `XamlTreeDump`, which is still used by [React Native for Windows](https://aka.ms/reactnative). 1. Added an `ExcludeIfValueIsUnset` boolean to `AttachedProperty`, which allows callers to specify that they don't want the attached property included in the dump if it's not explicitly set on the element. This specifically fixes the use case of adding more attached properties without necessarily polluting dumps with default values on every element (and allowing for checking that actual values were set). 2. Added a `PropertyValueConverter` delegate to `AttachedProperty`, which lets callers perform custom transformations on the values of attached properties. This specifically fixes the use case where custom WinRT enum types are stored in attached properties and the typing isn't available to XamlTreeDump, causing values to be returned as `System.__COMObject` types. Callers (with access to the correct typing) can do the transformation on XamlTreeDump's behalf. 3. Fixes an issue where boolean property values were not returned in a valid JSON format ('true' instead of 'True'). 4. Fixes the LastVersion to the actual last published version (1.0.9). 5. Adds copyright and license headers to every source file 6. Cleans up line endings and code formatting All changes have added unit tests and have been validated by this PR consuming the new features: microsoft/react-native-windows#11792
Tagging as a breaking change since I am changing idls. |
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.
Looks good to me
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.
👍
Description
Our existing implementation for
accessibilityState
does not support that the values of a state can benull
. This means every View has every unset state with the defaultfalse
value.The problem stems from implementing the short-lived
accessibilityStates
prop at the same time asaccessibilityState
, but not removing the deprecated API right away.This PR fixes our implementation to only include the states when explicitly set, and to otherwise clear them. This PR also removed the no longer required "opposite" states like
Collapsed
andUnchecked
.Resolves #11791
Type of Change
Why
Properly implement accessibility in preparation for doing the work correctly for Fabric.
Resolves #11791
What
Removed the old unused states and updated FrameworkElementViewManager to allow for unset values rather than forcing the default false. Updated AccessbilityStateChecked to accept an enum of Unchecked, Mixed, or Checked. Updated the DynamicAutomationPeer to only express a View has the appropriate provider iff the matching state is present on the view.
Screenshots
N/A
Testing
Updated E2E test snapshots to include the AccessibilityRole and AccessibilityState properties in the XAML tree dumps.
Microsoft Reviewers: codeflow:open?pullrequest=#11792