[Windows] Restore and enable IAccessibleEx implementation#175406
[Windows] Restore and enable IAccessibleEx implementation#175406loic-peron-inetum-public wants to merge 17 commits intoflutter:masterfrom
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request restores and enables the IAccessibleEx implementation, which exposes new UI Automation capabilities to the MSAA-based accessibility implementation on Windows. Specifically, it adds an identifier to SemanticsNode to expose AutomationId for UI testing. The changes correctly plumb this new field through the accessibility bridge and update relevant documentation and tests. My review includes a minor correction for the updated documentation to improve its accuracy.
engine/src/flutter/shell/platform/common/flutter_platform_node_delegate_unittests.cc
Outdated
Show resolved
Hide resolved
e9f2195 to
cceb784
Compare
7954197 to
a4f81de
Compare
|
@loic-sharma could you review this updated PR ? |
|
@loic-peron-inetum-public Thanks for the pull request! I'm a little concerned that this change might regress Flutter Windows's accessibility support in unexpected ways as a similar change to add UI Automation had caused unexpected problems. Could you include details on how you verified this change? What scenarios did you test? |
|
Regarding how we use and tests this proposal: We are building an application targeting iOS and Windows. We automate black-box tests using Appium on both platform. We use a custom build of the flutter engine for Windows that includes the required PR to get Semantics::identifer to be exposed as AutomationId. The application is not evaluated on its accessibility for actual users. Regarding UI Automation-related regressions: I understand that switching to UI Automation required a full switch in the accessibility interface exposed by Flutter. It seems that IAccessibleEx is a way to extend IAccessible-based exposition with the additional capabilities offered by UI Automation, without jeopardizing existing baheviours. What are the unexpected ways that triggered unexpected problems and regressed Flutter accessibility support during a previous attempt to switch to UI Automation ? How can I check them ? |
I would manually check that a sample Flutter Windows app still works well with JAWS, NVDA, and Windows Narrator. I'd make sure that as you tab around, the screen reader properly announces content, without any differences compared to today's implementation. Could we de-risk this by making the Flutter Windows's API has a Could we update Here's what this API might look like: // Configures the accessibility implementation used by Flutter.
enum class AccessibilityMode {
// Default value. Flutter will automatically select the best available
// implementation.
Default,
// Use the IAccessible implementation.
IAccessible,
// Use the experimental IAccessibleEx implementation.
IAccessibleEx,
};
class DartProject {
// Sets the accessibility implementation used by Flutter.
void set_accessibility_mode(AccessibilityMode accessibility_mode) {
accessibility_mode_ = accessibility_mode;
}
}To opt-in to the flutter::DartProject project(L"data");
project.set_accessibility_mode(flutter::AccessibilityMode::IAccessibleEx);Then, |
|
Note to self: these docs are an excellent resource to review this PR: https://learn.microsoft.com/en-us/windows/win32/winauto/implementing-iaccessibleex-for-providers |
I will try and implement an engine-runtime configuration option in november. Could this be enabled using an application-buildtime |
Sadly, no. The Windows embedder doesn't have an easy way to read Dart defines. The suggestion I left above means that the app developer will need to update the C++ code in their Flutter Windows entry point (example). |
|
Is progress still being made on this? |
Hi, yes I still work on this, but I have little work-time currently allocated for this tack. I still work to map the way from Would it be acceptable to use a technical attribute in |
Could you say more about why you need this? I think it's OK to add more data to |
may I know what property you want to add? also is |
|
@mattkae Could you do the second review for this PR? |
mattkae
left a comment
There was a problem hiding this comment.
Great work! I have one small nit, but looks good to me
engine/src/flutter/shell/platform/windows/flutter_project_bundle.h
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
There also doesn't seem to be any test added, should we get a test exemption? cc @loic-sharma since I am not too sure about the windows embedding code
| UIThreadPolicy ui_thread_policy() const { return ui_thread_policy_; } | ||
|
|
||
| // Sets the accessibility implementation used by Flutter. | ||
| void set_accessibility_mode(AccessibilityMode accessibility_mode) { |
There was a problem hiding this comment.
do you know who will be setting the mode?
There was a problem hiding this comment.
As proposed by @loic-sharma in #175406 (comment)
To opt-in to the IAccessibilityEx implementation, the app developer would need to modify their windows/runner/main.cpp file:
flutter::DartProject project(L"data"); project.set_accessibility_mode(flutter::AccessibilityMode::IAccessibleEx);
There was a problem hiding this comment.
I wonder why we don't do this the same way we do feature flags? @loic-sharma ?
There was a problem hiding this comment.
@chunhtai Sadly, embedders don't have a good way to read feature flags today. Currently, feature flags are stamped as Dart defines in the snapshot, so feature flags can't be read until the engine has launched the Dart isolate.
FYI, we used a similar approach for the merged threads migrations:
This is also similar to how we did the Impeller migration: each embedder exposed a configuration option to enable Impeller.
…_project_bundle fixup
…ect_bundle.h Co-authored-by: Matthew Kosarek <[email protected]>
bbf9c8d to
16c4496
Compare
Whoops, good catch. @loic-peron-inetum-public could you add a test for this? I'd consider a test that sends a flutter/engine/src/flutter/shell/platform/windows/window_unittests.cc Lines 364 to 379 in a132701 Your test can use |
|
I do not see how I can link a mocked I tried and failed to send Is there any additional element I should be aware of while continuing to try and implement this test ? |
|
I cannot manage to fails on @loic-sharma can you help me find what am I obviously missing ? |
|
@loic-peron-inetum-public FYI, you can use Visual Studio to debug the unit test. How to use Visual Studio to debug the unit test...
Here's a Dart test app that sends a semantic tree: flutter/engine/src/flutter/shell/platform/embedder/fixtures/main.dart Lines 1666 to 1736 in 72e216e Here's how you can pump win32 messages until the app sends a semantics tree: Please let me know if you have questions! |
16c4496



Restore and enable IAccessibleEx implementation.
Exposes new features of UI Automation to MSAA-based implementation.
Specifically usefull to expose AutomationId from SemanticsNode::identifier for UI test automation.
see #148763
Followup to #161955
Pre-launch Checklist
///).