Skip to content

Commit bb5cc62

Browse files
authored
[a11y] Map some framework semantics roles to android classes. (#185217)
In #183897 I added semantics roles in [AccessibilityBridge.java], I found some other current semantics roles can be mapped to android classes. There are some other android classes in AccessibilityBridge.java are currently set by flags instead of by roles. example: we use "isSlider" instead of slider role. we will need to add a slider role for it : #184029. ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 09bbf5d commit bb5cc62

10 files changed

Lines changed: 791 additions & 457 deletions

engine/src/flutter/shell/platform/android/BUILD.gn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,16 @@ android_java_sources = [
379379
"io/flutter/util/TraceSection.java",
380380
"io/flutter/util/ViewUtils.java",
381381
"io/flutter/view/AccessibilityBridge.java",
382+
"io/flutter/view/AccessibilityNodeConfigurator.java",
382383
"io/flutter/view/AccessibilityStringBuilder.java",
383384
"io/flutter/view/AccessibilityViewEmbedder.java",
385+
"io/flutter/view/BaseRoleConfigurator.java",
386+
"io/flutter/view/ClassNameRoleConfigurator.java",
387+
"io/flutter/view/ComboBoxRoleConfigurator.java",
384388
"io/flutter/view/FlutterCallbackInformation.java",
389+
"io/flutter/view/MenuRoleConfigurator.java",
390+
"io/flutter/view/ProgressBarRoleConfigurator.java",
391+
"io/flutter/view/RoleConfiguratorFactory.java",
385392
"io/flutter/view/TextureRegistry.java",
386393
"io/flutter/view/VsyncWaiter.java",
387394
]

engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java

Lines changed: 37 additions & 450 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
package io.flutter.view;
6+
7+
import android.view.accessibility.AccessibilityNodeInfo;
8+
9+
public interface AccessibilityNodeConfigurator {
10+
void configure(AccessibilityNodeInfo result, AccessibilityBridge.SemanticsNode node);
11+
}

0 commit comments

Comments
 (0)