flutter / flutter/flutter

[Accessibility] Semantics `header` property is ignored on Android

Open
#179,678 18 comments 5 reactions 1 assignee Claimed by @chunhtai View on GitHub
a: accessibility c: regression d: api docs P3 platform-android team-accessibility triaged-accessibility
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

1. Create a text view, marked as header:
```dart
Semantics(
header: true,
child: Text('Descriptive header')
);
```
2. Install on Android device
3. Navigate to the text view using TalkBack

This commit: https://github.com/flutter/flutter/commit/59d8010db5139da19b265c3f7cf29f90a86b8e5e has changed the logic for setting the `isHeading` property.

`result.setHeading(semanticsNode.hasFlag(Flag.IS_HEADER));` was replaced by `result.setHeading(semanticsNode.headingLevel > 0);` without a fallback.

Expected behavior would be to set `isHeading` to true if `Flag.IS_HEADER` OR `headingLevel > 0`.

### Expected results

TalkBack should announce the text view as header.

### Actual results

TalkBack does not announce is header.

### Code sample

```dart
Semantics(
header: true,
child: Text('Descriptive header')
);
```

### Screenshots or Video

The `isHeading` property is false in the accessibility tree.

Accessibility tree for Android app built in Flutter

### Logs

N/A

### Flutter Doctor output

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.