Open
Description
Steps to reproduce
- Use voiceover and swipe right to traverse to the next item.
Expected results
Accessibility focus ring wraps the entire element.
Actual results
Accessibility focus tightly wraps invisible label.
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
/// Flutter code sample for [SliverEnsureSemantics].
void main() {
runApp(const SliverEnsureSemanticsExampleApp());
SemanticsBinding.instance.ensureSemantics();
}
class SliverEnsureSemanticsExampleApp extends StatelessWidget {
const SliverEnsureSemanticsExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(home: const SliverEnsureSemanticsExample());
}
}
class SliverEnsureSemanticsExample extends StatefulWidget {
const SliverEnsureSemanticsExample({super.key});
@override
State<SliverEnsureSemanticsExample> createState() =>
_SliverEnsureSemanticsExampleState();
}
class _SliverEnsureSemanticsExampleState
extends State<SliverEnsureSemanticsExample> {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
backgroundColor: theme.colorScheme.inversePrimary,
title: Text('SliverEnsureSemantics Demo'),
),
body: Center(
child: CustomScrollView(
semanticChildCount: 1,
slivers: <Widget>[
SliverToBoxAdapter(
child: IndexedSemantics(
index: 0,
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Semantics(
header: true,
child: Text('Steps to reproduce', style: theme.textTheme.headlineSmall),
),
const Text('Issue description'),
Semantics(
header: true,
child: Text('Expected Results', style: theme.textTheme.headlineSmall),
),
Semantics(
header: true,
child: Text('Actual Results', style: theme.textTheme.headlineSmall),
),
Semantics(
header: true,
child: Text('Code Sample', style: theme.textTheme.headlineSmall),
),
Semantics(
header: true,
child: Text('Screenshots', style: theme.textTheme.headlineSmall),
),
Semantics(
header: true,
child: Text('Logs', style: theme.textTheme.headlineSmall),
),
],
),
),
),
),
),
],
),
),
);
}
}