Skip to content

[iOS] Hide the iOS 26 scroll-edge effect on the embedder's helper scrollviews - #192374

Closed
JakeThomson wants to merge 2 commits into
flutter:masterfrom
JakeThomson:ios-hide-scroll-edge-effect-helper-scrollviews
Closed

JakeThomson wants to merge 2 commits into
flutter:masterfrom
JakeThomson:ios-hide-scroll-edge-effect-helper-scrollviews

Conversation

@JakeThomson

Copy link
Copy Markdown

iOS 26 paints a scroll-edge effect (a blur and a light wash under the status bar) over any UIScrollView whose content offset is non-zero. The iOS embedder keeps two scroll views under FlutterView that never draw anything but do sit at a non-zero offset: the scroll-to-top helper in -[FlutterViewController loadView], and a FlutterSemanticsScrollView per scrollable semantics node, whose offset mirrors the Dart scroll position for assistive technology. As soon as a Dart scrollable scrolls, iOS frosts the top ~60pt of whatever Flutter rendered. Over a full-bleed image it reads as a frosted band, and during an interactive pop it smears the page's colour outside the rounded corner clip.

This hides topEdgeEffect and bottomEdgeEffect on both views. The change is behind @available(iOS 26.0, *) and an __IPHONE_26_0 SDK guard, so it is a no-op on earlier iOS and compiles on toolchains without the iOS 26 SDK.

Reproduced on an iPhone 17 simulator (iOS 26 runtime) with a plain UIKit probe: a coloured view under the status bar shows no band, a transparent UIScrollView at a non-zero offset on top of it reproduces the band exactly, and topEdgeEffect.hidden = YES removes it. Applying the same change from app code to a Flutter app removed the band there. Before/after screenshots are on the issue.

Fixes #192372

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

…oll views

iOS 26 paints a scroll-edge effect over any UIScrollView whose content
offset is non-zero. The embedder's scroll-to-top helper and the
FlutterSemanticsScrollView mirrors never draw anything but sit at a
non-zero offset, so iOS frosts the top of whatever Flutter rendered.
Hide topEdgeEffect and bottomEdgeEffect on both.

Fixes flutter#192372
@JakeThomson
JakeThomson requested a review from a team as a code owner September 7, 2026 13:41
@github-actions github-actions Bot added platform-ios iOS applications specifically engine flutter/engine related. See also e: labels. team-ios Owned by iOS platform team labels Sep 7, 2026
@JakeThomson JakeThomson changed the title [iOS] Hide the iOS 26 scroll-edge effect on the embedder's helper scr… [iOS] Hide the iOS 26 scroll-edge effect on the embedder's helper scrollviews Sep 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request hides the top and bottom scroll-edge effects on iOS 26.0 and above for both FlutterSemanticsScrollView and FlutterViewController's scroll view to prevent visual artifacts over Flutter-rendered content. Feedback on the accompanying tests recommends initializing the FlutterEngine without running it to avoid potential flakiness, and allocating MockAccessibilityBridge on the stack instead of the heap to prevent a memory leak.

Comment on lines +1484 to +1488
FlutterEngine* engine = [[FlutterEngine alloc] init];
[engine runWithEntrypoint:nil];
FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine
nibName:nil
bundle:nil];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Starting the full Flutter engine with runWithEntrypoint: is unnecessary for testing loadView on FlutterViewController. It spins up background threads and can lead to resource leaks or test flakiness. We can simply initialize the engine without running it.

    FlutterEngine* engine = [[FlutterEngine alloc] init];
    FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine
                                                                                  nibName:nil
                                                                                   bundle:nil];
References
  1. Code should follow the guidance described in the writing effective tests guide and be kept as simple and lightweight as possible. (link)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept as is: every existing test in this file that calls loadView runs the engine first (testViewDidLoadWillInvokeCreateTouchRateCorrectionVSyncClient and the three others), so this follows the established pattern rather than introducing a second way of setting up a view controller for loadView. Happy to switch if a reviewer prefers the lighter setup for all of them.

Comment on lines +47 to +48
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
new flutter::testing::MockAccessibilityBridge());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The MockAccessibilityBridge is allocated on the heap using new, but fml::WeakPtrFactory does not take ownership of the pointer or delete it upon destruction. This causes a memory leak in the test suite. Allocating the mock bridge on the stack instead avoids the leak and is safer.

    flutter::testing::MockAccessibilityBridge mock_bridge;
    fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(&mock_bridge);
References
  1. Code should follow best practices for writing effective tests, including avoiding memory leaks and resource exhaustion. (link)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept as is: all 56 mock bridges in this file are created the same way, new MockAccessibilityBridge() handed to a fml::WeakPtrFactory, starting with testCreate directly above. The new test mirrors that so it reads like its neighbours. If the allocation pattern should change, that's a file-wide cleanup rather than something to do in one test.

// light wash under the status bar) over any scrolled UIScrollView, which
// would frost whatever Flutter rendered beneath this one as soon as the
// Dart scrollable moves.
#if defined(__IPHONE_26_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_26_0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this required?

// This is an arbitrary offset that is not CGPointZero.
scrollView.contentOffset = CGPointMake(kScrollViewContentSize, kScrollViewContentSize);
// A non-zero offset reads as scrolled content to iOS 26, which paints a
// scroll-edge effect under the status bar over whatever Flutter rendered.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's hard to picture in mind from the description here. Can you link to the issue?

#if defined(__IPHONE_26_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_26_0
if (@available(iOS 26.0, *)) {
self.topEdgeEffect.hidden = YES;
self.bottomEdgeEffect.hidden = YES;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we dont want to also implement leftEdgeEffect and rightEdgeEffect?

@LongCatIsLooong LongCatIsLooong added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 23, 2026
@flutter-dashboard

Copy link
Copy Markdown

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions

Copy link
Copy Markdown

This pull request is being closed because it has not been updated in the last 21 days after a request for more information.

If you are still working on this, please feel free to reopen it or file a new pull request.

Thanks for your contribution.

@github-actions github-actions Bot closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS 26] Status-bar scroll-edge effect blurs Flutter content because FlutterSemanticsScrollView mirrors the Dart scroll offset

5 participants