Skip to content

Scrollable containers don't make edge elements fully visible when swiping a11y focus on iOS #61624

@nscobie

Description

@nscobie

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;
  }
}

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)a: qualityA truly polished experiencecustomer: money (g3)engineflutter/engine related. See also e: labels.f: scrollingViewports, list views, slivers, etc.found in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallywaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions