Skip to content

[Android] Use headingLevel for heading accessibility property - #175416

Merged
auto-submit[bot] merged 8 commits into
flutter:masterfrom
mnayef95:semantics-heading-level
Sep 29, 2025
Merged

auto-submit[bot] merged 8 commits into
flutter:masterfrom
mnayef95:semantics-heading-level

Conversation

@mnayef95

@mnayef95 mnayef95 commented Sep 16, 2025 •

Copy link
Copy Markdown
Contributor

talabat.com Talabat Flutter PRs

Fixes #174150

This PR updates the Android AccessibilityBridge to use the headingLevel property from SemanticsNode to determine if a node should be marked as a heading for accessibility purposes.

Previously, the IS_HEADER flag was used. Now, a node is considered a heading if headingLevel > 0. This aligns with the common accessibility pattern where heading levels (like H1, H2, etc.) define the structure.

The following changes were made:

  • Modified AccessibilityBridge.java to set the heading status based on semanticsNode.headingLevel > 0 for Android API level 28 and above.
  • Added headingLevel to the SemanticsNode data structure in Java and its serialization/deserialization logic.
  • Updated the C++ PlatformViewAndroidDelegate to include headingLevel when serializing SemanticsNode data.
  • Increased kBytesPerNode in platform_view_android_delegate.h to account for the new headingLevel field.
  • Added tests in AccessibilityBridgeTest.java to verify the new heading logic:
    • Nodes with headingLevel = 0 are not headings.
    • Nodes with headingLevel > 0 are headings.

Pre-launch Checklist

@mnayef95
mnayef95 requested a review from a team as a code owner September 16, 2025 12:50
@google-cla

google-cla Bot commented Sep 16, 2025

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions Bot added platform-android Android applications specifically engine flutter/engine related. See also e: labels. team-android Owned by Android platform team labels Sep 16, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly updates the Android accessibility implementation to use the headingLevel property for determining headings, moving away from the older IS_HEADER flag. The changes are consistently applied across the Java and C++ layers, including serialization and deserialization logic. The adjustment to kBytesPerNode is correct, and the new unit tests thoroughly validate the new behavior, including edge cases. I have a couple of minor suggestions to improve code clarity and test structure, but overall this is a solid improvement.

@mnayef95
mnayef95 force-pushed the semantics-heading-level branch 2 times, most recently from b667fb8 to 2920d02 Compare September 16, 2025 13:00
@mnayef95
mnayef95 marked this pull request as draft September 16, 2025 13:17
@flutter-dashboard

Copy link
Copy Markdown

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@mnayef95
mnayef95 force-pushed the semantics-heading-level branch 2 times, most recently from 9081031 to ceb0889 Compare September 17, 2025 11:50
@mnayef95
mnayef95 marked this pull request as ready for review September 17, 2025 12:20
@mnayef95
mnayef95 force-pushed the semantics-heading-level branch from f6b117a to dfd7461 Compare September 17, 2025 13:18
@github-actions github-actions Bot added the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Sep 17, 2025
@mnayef95
mnayef95 force-pushed the semantics-heading-level branch from b256564 to e5f52b2 Compare September 17, 2025 16:32

@chinmaygarde chinmaygarde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The major concern is the breaking ABI change. Left some suggestions on how to avoid it.

Comment thread engine/src/flutter/shell/platform/embedder/embedder.h Outdated
@mnayef95
mnayef95 force-pushed the semantics-heading-level branch 7 times, most recently from 0bbb4ec to 8204134 Compare September 19, 2025 07:35
@mnayef95
mnayef95 force-pushed the semantics-heading-level branch from f01f2d4 to ca98f06 Compare September 19, 2025 10:07
@chinmaygarde
chinmaygarde dismissed their stale review September 22, 2025 18:44

The requested changes have been made.

@chinmaygarde

Copy link
Copy Markdown
Contributor

The embedder API change LGTM. I'll leave the rest to the @flutter/android-reviewers. Thanks!

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 29, 2025
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 29, 2025
Merged via the queue into flutter:master with commit 59d8010 Sep 29, 2025
188 of 189 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 29, 2025
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 1, 2025
Manual roll requested by [email protected]

flutter/flutter@96fe3b3...c9608e2

2025-09-30 [email protected] Implement framework interface for the dialog window archetype (flutter/flutter#176202)
2025-09-30 [email protected] Update flutter test to use SemanticsFlags (flutter/flutter#175987)
2025-09-30 [email protected] Set minimum supported java version to 17  (flutter/flutter#176226)
2025-09-30 [email protected] Reduce timeout for Linux web_tool_tests back to 60 (flutter/flutter#176286)
2025-09-30 [email protected] Roll Packages from 34eec78 to 287739d (9 revisions) (flutter/flutter#176284)
2025-09-30 [email protected] [web] Bump Firefox to 143.0 (flutter/flutter#176110)
2025-09-30 [email protected] Migrate to `WidgetStateBorderSide` (flutter/flutter#176164)
2025-09-30 [email protected] Enhance input decorator padding logic for character counter in text f… (flutter/flutter#175706)
2025-09-30 [email protected] Update the test package for the web engine unit test bits. (flutter/flutter#176241)
2025-09-30 [email protected] Warn if embedder API calls don't return success (flutter/flutter#176184)
2025-09-30 [email protected] Roll Fuchsia Test Scripts from APSBP-sS-3FX69Ihf... to JUeFbA8y0E-_pj-bg... (flutter/flutter#176243)
2025-09-30 [email protected] Roll GN to 81b24e01 (flutter/flutter#176119)
2025-09-29 [email protected] Rename DisplayMonitor to DisplayManager on Win32 (flutter/flutter#175619)
2025-09-29 [email protected] [Android] Use headingLevel for heading accessibility property (flutter/flutter#175416)
2025-09-29 [email protected] BUILD.gn: Support LTO build on Linux (flutter/flutter#176191)
2025-09-29 [email protected] fix `assertEquals` arguments are in wrong order in `FlutterJNITest.java` (flutter/flutter#175728)
2025-09-29 [email protected] Add tests for `Project` getters  (flutter/flutter#175994)
2025-09-29 [email protected] Roll Fuchsia Linux SDK from 8zjcJic_DtvB2Bo2x... to rcOl0yxJb4znJ903Y... (flutter/flutter#176215)
2025-09-29 [email protected] Clean up typos in `PlatformViewsControllerTest.java` (flutter/flutter#175725)
2025-09-29 [email protected] Migrate java 11 usage to java 17 usage for templates (flutter/flutter#176203)
2025-09-29 [email protected] User Invoke-Expression instead of call operator for nested Powershell scripts invocations (on Windows) (flutter/flutter#175941)
2025-09-29 [email protected] Update changelog as on 3.35 branch (flutter/flutter#176216)
2025-09-29 [email protected] fix typo in `Crashes.md` (flutter/flutter#175959)
2025-09-29 [email protected] Add scene plugin lifecycle events (flutter/flutter#175866)
2025-09-29 [email protected] Migrate tests and documentation to set java version to 17 (flutter/flutter#176204)
2025-09-29 [email protected] Update Engine CI to use NDK r28c  (flutter/flutter#175870)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
okorohelijah pushed a commit to okorohelijah/flutter that referenced this pull request Oct 7, 2025
…r#175416)

Fixes flutter#174150

This PR updates the Android `AccessibilityBridge` to use the
`headingLevel` property from `SemanticsNode` to determine if a node
should be marked as a heading for accessibility purposes.

Previously, the `IS_HEADER` flag was used. Now, a node is considered a
heading if `headingLevel > 0`. This aligns with the common accessibility
pattern where heading levels (like H1, H2, etc.) define the structure.

The following changes were made:
- Modified `AccessibilityBridge.java` to set the heading status based on
`semanticsNode.headingLevel > 0` for Android API level 28 and above.
- Added `headingLevel` to the `SemanticsNode` data structure in Java and
its serialization/deserialization logic.
- Updated the C++ `PlatformViewAndroidDelegate` to include
`headingLevel` when serializing `SemanticsNode` data.
- Increased `kBytesPerNode` in `platform_view_android_delegate.h` to
account for the new `headingLevel` field.
- Added tests in `AccessibilityBridgeTest.java` to verify the new
heading logic:
    - Nodes with `headingLevel = 0` are not headings.
    - Nodes with `headingLevel > 0` are headings.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.


<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[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
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…r#175416)

Fixes flutter#174150

This PR updates the Android `AccessibilityBridge` to use the
`headingLevel` property from `SemanticsNode` to determine if a node
should be marked as a heading for accessibility purposes.

Previously, the `IS_HEADER` flag was used. Now, a node is considered a
heading if `headingLevel > 0`. This aligns with the common accessibility
pattern where heading levels (like H1, H2, etc.) define the structure.

The following changes were made:
- Modified `AccessibilityBridge.java` to set the heading status based on
`semanticsNode.headingLevel > 0` for Android API level 28 and above.
- Added `headingLevel` to the `SemanticsNode` data structure in Java and
its serialization/deserialization logic.
- Updated the C++ `PlatformViewAndroidDelegate` to include
`headingLevel` when serializing `SemanticsNode` data.
- Increased `kBytesPerNode` in `platform_view_android_delegate.h` to
account for the new `headingLevel` field.
- Added tests in `AccessibilityBridgeTest.java` to verify the new
heading logic:
    - Nodes with `headingLevel = 0` are not headings.
    - Nodes with `headingLevel > 0` are headings.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.


<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[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
Jyndigo pushed a commit to uesp/webview_flutter_x that referenced this pull request Apr 15, 2026
…(#10145)

Manual roll requested by [email protected]

flutter/flutter@96fe3b3...c9608e2

2025-09-30 [email protected] Implement framework interface for the dialog window archetype (flutter/flutter#176202)
2025-09-30 [email protected] Update flutter test to use SemanticsFlags (flutter/flutter#175987)
2025-09-30 [email protected] Set minimum supported java version to 17  (flutter/flutter#176226)
2025-09-30 [email protected] Reduce timeout for Linux web_tool_tests back to 60 (flutter/flutter#176286)
2025-09-30 [email protected] Roll Packages from 34eec7850cce to 287739d0acce (9 revisions) (flutter/flutter#176284)
2025-09-30 [email protected] [web] Bump Firefox to 143.0 (flutter/flutter#176110)
2025-09-30 [email protected] Migrate to `WidgetStateBorderSide` (flutter/flutter#176164)
2025-09-30 [email protected] Enhance input decorator padding logic for character counter in text f… (flutter/flutter#175706)
2025-09-30 [email protected] Update the test package for the web engine unit test bits. (flutter/flutter#176241)
2025-09-30 [email protected] Warn if embedder API calls don't return success (flutter/flutter#176184)
2025-09-30 [email protected] Roll Fuchsia Test Scripts from APSBP-sS-3FX69Ihf... to JUeFbA8y0E-_pj-bg... (flutter/flutter#176243)
2025-09-30 [email protected] Roll GN to 81b24e01 (flutter/flutter#176119)
2025-09-29 [email protected] Rename DisplayMonitor to DisplayManager on Win32 (flutter/flutter#175619)
2025-09-29 [email protected] [Android] Use headingLevel for heading accessibility property (flutter/flutter#175416)
2025-09-29 [email protected] BUILD.gn: Support LTO build on Linux (flutter/flutter#176191)
2025-09-29 [email protected] fix `assertEquals` arguments are in wrong order in `FlutterJNITest.java` (flutter/flutter#175728)
2025-09-29 [email protected] Add tests for `Project` getters  (flutter/flutter#175994)
2025-09-29 [email protected] Roll Fuchsia Linux SDK from 8zjcJic_DtvB2Bo2x... to rcOl0yxJb4znJ903Y... (flutter/flutter#176215)
2025-09-29 [email protected] Clean up typos in `PlatformViewsControllerTest.java` (flutter/flutter#175725)
2025-09-29 [email protected] Migrate java 11 usage to java 17 usage for templates (flutter/flutter#176203)
2025-09-29 [email protected] User Invoke-Expression instead of call operator for nested Powershell scripts invocations (on Windows) (flutter/flutter#175941)
2025-09-29 [email protected] Update changelog as on 3.35 branch (flutter/flutter#176216)
2025-09-29 [email protected] fix typo in `Crashes.md` (flutter/flutter#175959)
2025-09-29 [email protected] Add scene plugin lifecycle events (flutter/flutter#175866)
2025-09-29 [email protected] Migrate tests and documentation to set java version to 17 (flutter/flutter#176204)
2025-09-29 [email protected] Update Engine CI to use NDK r28c  (flutter/flutter#175870)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…0145)

Manual roll requested by [email protected]

flutter/flutter@96fe3b3...c9608e2

2025-09-30 [email protected] Implement framework interface for the dialog window archetype (flutter/flutter#176202)
2025-09-30 [email protected] Update flutter test to use SemanticsFlags (flutter/flutter#175987)
2025-09-30 [email protected] Set minimum supported java version to 17  (flutter/flutter#176226)
2025-09-30 [email protected] Reduce timeout for Linux web_tool_tests back to 60 (flutter/flutter#176286)
2025-09-30 [email protected] Roll Packages from 34eec78 to 287739d (9 revisions) (flutter/flutter#176284)
2025-09-30 [email protected] [web] Bump Firefox to 143.0 (flutter/flutter#176110)
2025-09-30 [email protected] Migrate to `WidgetStateBorderSide` (flutter/flutter#176164)
2025-09-30 [email protected] Enhance input decorator padding logic for character counter in text f… (flutter/flutter#175706)
2025-09-30 [email protected] Update the test package for the web engine unit test bits. (flutter/flutter#176241)
2025-09-30 [email protected] Warn if embedder API calls don't return success (flutter/flutter#176184)
2025-09-30 [email protected] Roll Fuchsia Test Scripts from APSBP-sS-3FX69Ihf... to JUeFbA8y0E-_pj-bg... (flutter/flutter#176243)
2025-09-30 [email protected] Roll GN to 81b24e01 (flutter/flutter#176119)
2025-09-29 [email protected] Rename DisplayMonitor to DisplayManager on Win32 (flutter/flutter#175619)
2025-09-29 [email protected] [Android] Use headingLevel for heading accessibility property (flutter/flutter#175416)
2025-09-29 [email protected] BUILD.gn: Support LTO build on Linux (flutter/flutter#176191)
2025-09-29 [email protected] fix `assertEquals` arguments are in wrong order in `FlutterJNITest.java` (flutter/flutter#175728)
2025-09-29 [email protected] Add tests for `Project` getters  (flutter/flutter#175994)
2025-09-29 [email protected] Roll Fuchsia Linux SDK from 8zjcJic_DtvB2Bo2x... to rcOl0yxJb4znJ903Y... (flutter/flutter#176215)
2025-09-29 [email protected] Clean up typos in `PlatformViewsControllerTest.java` (flutter/flutter#175725)
2025-09-29 [email protected] Migrate java 11 usage to java 17 usage for templates (flutter/flutter#176203)
2025-09-29 [email protected] User Invoke-Expression instead of call operator for nested Powershell scripts invocations (on Windows) (flutter/flutter#175941)
2025-09-29 [email protected] Update changelog as on 3.35 branch (flutter/flutter#176216)
2025-09-29 [email protected] fix typo in `Crashes.md` (flutter/flutter#175959)
2025-09-29 [email protected] Add scene plugin lifecycle events (flutter/flutter#175866)
2025-09-29 [email protected] Migrate tests and documentation to set java version to 17 (flutter/flutter#176204)
2025-09-29 [email protected] Update Engine CI to use NDK r28c  (flutter/flutter#175870)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) engine flutter/engine related. See also e: labels. platform-android Android applications specifically team-android Owned by Android platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android][A11y] AccessibilityBridge misuses setHeading

5 participants