Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Set heading semantics for Flag.IS_HEADER#179681

Closed
JJdeGroot wants to merge 1 commit intoflutter:masterfrom
JJdeGroot:master
Closed

Set heading semantics for Flag.IS_HEADER#179681
JJdeGroot wants to merge 1 commit intoflutter:masterfrom
JJdeGroot:master

Conversation

@JJdeGroot
Copy link

@JJdeGroot JJdeGroot commented Dec 10, 2025

Fixes broken heading semantics, due to a breaking change in #175416
This PR adds backwards compatibility for setting header semantics by taking both Flag.IS_HEADER and headingLevel into account.
It also adds a test for Flag.IS_HEADER to prevent future breaking changes.

Fixes: #179678

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. 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.

@JJdeGroot JJdeGroot requested a review from a team as a code owner December 10, 2025 12:09
@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 Dec 10, 2025
@google-cla
Copy link

google-cla bot commented Dec 10, 2025

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.

Copy link
Contributor

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

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 addresses a regression in heading semantics by restoring support for the Flag.IS_HEADER. The change correctly uses a logical OR to consider both Flag.IS_HEADER and headingLevel > 0 for determining if a node is a heading, ensuring backward compatibility. A new test case is also added to verify the behavior of Flag.IS_HEADER, preventing future regressions. The changes are correct, and the added test is well-written and provides good coverage for the fix.

// Heading support
if (Build.VERSION.SDK_INT >= API_LEVELS.API_28) {
result.setHeading(semanticsNode.headingLevel > 0);
result.setHeading(semanticsNode.hasFlag(Flag.IS_HEADER) || semanticsNode.headingLevel > 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like #175416 explicitly meant to remove the need for Flag.IS_HEADER. Can you clarify the case where that fallback is needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, the header doesn't translate to the heading in android, that is the reason for original change

@camsim99 camsim99 requested a review from chunhtai December 16, 2025 18:26
@chunhtai
Copy link
Contributor

Closing as not planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[Accessibility] Semantics header property is ignored on Android

3 participants