Skip to content

Flutter Web Semantics does not announce the same announcement multiple times in a row #142250

@tugorez

Description

@tugorez

Steps to reproduce

Run the sample app and click the Different announcements and Same announcements buttons multiple times.

Expected results

Similar to how all the Different announcements generated are being read and announced by the screen reader, all the Same announcements should be read/announced as well by the screen reader.

Actual results

When "announcing" messages with the same content some of them are being dropped.

Code sample

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

const Color darkBlue = Color.fromARGB(255, 18, 32, 47);

var count = 0;

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: darkBlue,
      ),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        OutlinedButton(
          onPressed: () async {
            final textDirection = Directionality.of(context);
            await SemanticsService.announce('Test announcement $count', textDirection, assertiveness: Assertiveness.assertive);
            count++;
          },
          child: Text(
            'Different announcements',
            style: Theme.of(context).textTheme.headlineMedium,
          ),
        ),
        OutlinedButton(
          onPressed: () async {
            final textDirection = Directionality.of(context);
            await SemanticsService.announce('Test announcement', textDirection,  assertiveness: Assertiveness.assertive);
          },
          child: Text(
            'Same announcements',
            style: Theme.of(context).textTheme.headlineMedium,
          ),
        ),
      ],
    );
  }
}

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions