Add SliverAppBar showOnScreen semantics test coverage (#190410)
In https://github.com/flutter/flutter/pull/186611 the widgets test `showOnScreen works with pinned app bar and sliver list` was switched from `SliverAppBar` to a private `SliverPersistentHeader` delegate, as part of removing the `material` import from `scrollable_semantics_test.dart`. That was the only test exercising `SemanticsAction.showOnScreen` against a pinned `SliverAppBar`, so the Material path lost coverage and a TODO was left behind to track restoring it. This PR restores the coverage by adding an equivalent test to `packages/flutter/test/material/app_bar_sliver_test.dart`, which already imports `../widgets/semantics_tester.dart` and is where the other `SliverAppBar` semantics tests live. The test performs `SemanticsAction.showOnScreen` on the first list item and asserts it is revealed *below* the pinned app bar (`dy == expandedHeight`) rather than underneath it. I also removed the TODO in `packages/flutter/test/widgets/scrollable_semantics_test.dart`, since it points at the issue this PR fixes. Note that the TODO says "in material_ui package" — that package does not exist in the repo yet, so the test is placed in the existing Material test suite (which matches the issue description) and will move along with `app_bar_sliver_test.dart` when the decoupling work lands. Happy to keep the TODO instead if you'd prefer to track the `material_ui` move separately. Verification: - `flutter test packages/flutter/test/material/app_bar_sliver_test.dart` — 53 tests pass. - `flutter test packages/flutter/test/widgets/scrollable_semantics_test.dart` — 20 tests pass. - To confirm the assertion is load-bearing, flipping `pinned` to `false` fails the new test with `Expected: <56.0> Actual: <6.0>`. Fixes https://github.com/flutter/flutter/issues/189117 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
B
Bui Anh Viet committed
edd4547f9ebd51f93a2bbdc0bd7b156a4bb35217
Parent: c3dbaab
Committed by GitHub <noreply@github.com>
on 8/26/2026, 10:13:11 PM