Skip to content

With EnsureSemantics(), a Scrollable Widget with Internal Widget with NeverScrollableScrollPhysics Causes Jerky Scrolling #159358

Closed

Description

@emma-roudabush-disney

Steps to reproduce

  1. Have a web app with ensureSemantics ran
  2. Have a listview with internal listview
  3. Have the internal listview have NeverScrollableScrollPhysics()
  4. Run web app and scroll

Expected results

Scroll is smooth

Actual results

Scroll jerks around/jumps when scrolling up or down

If ensureSemantics is removed or if GridView or ListView (with NeverScrollableScrollPhysics) is removed or replaced, scroll is smooth.

Code sample

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  SemanticsBinding.instance.ensureSemantics();
  runApp(const TestApp());
}

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: TestPage(),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return ListView(
      padding: EdgeInsets.zero,
      children: [
        SizedBox(
          height: 500.0,
          width: 400.0,
          child: ListView(
            scrollDirection: Axis.horizontal,
            physics: const NeverScrollableScrollPhysics(),
            children: [
              Container(color: Colors.red, height: 500, width: 100.0),
              Container(color: Colors.blue, height: 500, width: 100.0),
              Container(color: Colors.green, height: 500, width: 100.0),
            ],
          ),
        ),
        ...List.generate(
          20,
          (index) => ListTile(
            title: Text('Test Item $index'),
            leading: const Icon(Icons.list),
            trailing: const Icon(Icons.arrow_forward),
          ),
        ),
      ],
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Screen.Recording.2024-11-19.at.4.17.44.PM.mov

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output

Was able to repro on Flutter version 3.24.2 and 3.27.0-0.1.pre
Unable to repro on Flutter version 3.22.2

Activity

  1. darshankawar commented on Nov 25, 2024

    @darshankawar
    Member

    @emma-roudabush-disney Thanks for the report.

    I was able to replicate this on latest master, but not in latest stable (3.24.5).

    1. Master : 3.27.0-1.0.pre.628
    159358_m.mov
    1. stable : 3.24.5
    159358_s.mov
  2. added
    c: regressionIt was better in the past than it is now
    frameworkflutter/packages/flutter repository. See also f: labels.
    f: scrollingViewports, list views, slivers, etc.
    platform-webWeb applications specifically
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    in triagePresently being triaged by the triage team
    on Nov 25, 2024
  3. added
    workaround availableThere is a workaround available to overcome the issue
    P2Important issues not at the top of the work list
    on Dec 6, 2024
  4. Piinks commented on Dec 6, 2024

    @Piinks
    Contributor

    Refactoring to avoid nesting ListViews is an available work around here while we investigate this issue:

    import 'package:flutter/material.dart';
    import 'package:flutter/rendering.dart';
    
    void main() {
      WidgetsFlutterBinding.ensureInitialized();
      SemanticsBinding.instance.ensureSemantics();
      runApp(const TestApp());
    }
    
    class TestApp extends StatelessWidget {
      const TestApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return const MaterialApp(
          home: Scaffold(
            body: TestPage(),
          ),
        );
      }
    }
    
    class TestPage extends StatelessWidget {
      const TestPage({super.key});
    
      @override
      Widget build(BuildContext context) {
        return CustomScrollView(
          slivers: [
            SliverToBoxAdapter(
              child: Row(
                children: [
                  Container(color: Colors.red, height: 500, width: 100.0),
                  Container(color: Colors.blue, height: 500, width: 100.0),
                  Container(color: Colors.green, height: 500, width: 100.0),
                ],
              ),
            ),
            SliverList.list(
              children: List.generate(
                20,
                (index) => ListTile(
                  title: Text('Test Item $index'),
                  leading: const Icon(Icons.list),
                  trailing: const Icon(Icons.arrow_forward),
                ),
              ),
            ),
          ],
        );
      }
    }
    
  5. 4 remaining items

  6. added
    team-webOwned by Web platform team
    and removed
    P2Important issues not at the top of the work list
    on Feb 4, 2025
  7. added
    P2Important issues not at the top of the work list
    triaged-webTriaged by Web platform team
    on Feb 12, 2025
  8. self-assigned this
    on Feb 18, 2025
  9. added
    P1High-priority issues at the top of the work list
    and removed
    P2Important issues not at the top of the work list
    on Feb 18, 2025
  10. added
    r: fixedIssue is closed as already fixed in a newer version
    on Feb 20, 2025
  11. github-actions commented on Mar 6, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)c: regressionIt was better in the past than it is nowcustomer: castawayf: scrollingViewports, list views, slivers, etc.found in release: 3.27Found to occur in 3.27frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamtriaged-webTriaged by Web platform teamworkaround availableThere is a workaround available to overcome the issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions