Skip to content

A11Y can't add text to headers #184568

@paul-geoghegan

Description

@paul-geoghegan

Steps to reproduce

  1. Enable the Orca screen reader on Linux.
  2. Run the attached code sample as a Linux desktop application (flutter run -d linux).
  3. Press the Tab key to move keyboard focus to the second element on the screen.
  4. Observe the Orca speech output.

Expected results

When focusing the first element, Orca should read "I am focusable normal text".
When tabbing to the second element, Orca should read the text payload followed by the semantic role (e.g., "I am a focusable header, header").

Actual results

When tabbing to the second element, Orca drops the text payload entirely and simply announces "header".

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const BugReproApp());
}

class BugReproApp extends StatelessWidget {
  const BugReproApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              // 1. Focusable Text (Works)
              // Orca correctly reads "I am focusable normal text".
              Focus(
                autofocus: true,
                child: const Text('I am focusable normal text'),
              ),
              
              const SizedBox(height: 50),
              
              // 2. Focusable Header (Bugged)
              // Because of the header trait, Orca drops the text payload completely and only announces "header".
              Focus(
                child: Semantics(
                  header: true,
                  child: const Text('I am a focusable header'),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.41.5, on Ubuntu Resolute Raccoon (development branch) 7.0.0-10-generic, locale
    en_US.UTF-8)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[✓] Connected device (1 available)
[✓] Network resources
! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)platform-linuxBuilding on or for Linux specificallyteam-linuxOwned by the Linux platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions