-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Related: #36307 for Android GridView issues.
Problem
When using an accessibility service on iOS (VoiceOver), focusing on an element (by tap or swipe) in a scrollable container (GridView, ListView, etc.) which is partially obscured does not make the element fully visible. However, swiping to a fully hidden element beyond the currently visible items does make the element visible by scrolling the list.
Background
Implicit accessibility scrolling on iOS (ex: VoiceOver) is achieved by caching the next few items outside of view of the current scroll area in the semantic tree, but marking them as isHidden. When the accessibility focus moves from an item in the visible viewport to an isHidden item in the cache area (ex: swiping right with VoiceOver), the engine will call showOnScreen on the widget.
What needs to change
We likely need to also call showOnScreen for items which are partially obscured, but not marked as isHidden.
Sample taken from #36307
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
State createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool useSemanticsDebugger = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
showSemanticsDebugger: useSemanticsDebugger,
theme: ThemeData(primaryColor: Colors.blue),
home: Scaffold(
appBar: AppBar(
title: Text('GridView Semantics Test'),
),
body: GridView.count(crossAxisCount: 4,
// body: ListView( // Try swapping the GridView for this ListView. The problem happens for both.
children: _buildChildren(context),
),
));
}
List<Widget> _buildChildren(BuildContext context) {
final widgets = List<Widget>();
for(int i = 0; i < 100; ++i) {
widgets.add(ListTile(
title: Text('Cell $i'),
));
}
return widgets;
}
}