Repository navigation
[iOS] Hide the iOS 26 scroll-edge effect on the embedder's helper scrollviews - #192374
JakeThomson wants to merge 2 commits into
Conversation
…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
There was a problem hiding this comment.
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.
| FlutterEngine* engine = [[FlutterEngine alloc] init]; | ||
| [engine runWithEntrypoint:nil]; | ||
| FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine | ||
| nibName:nil | ||
| bundle:nil]; |
There was a problem hiding this comment.
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
- Code should follow the guidance described in the writing effective tests guide and be kept as simple and lightweight as possible. (link)
There was a problem hiding this comment.
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.
| fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory( | ||
| new flutter::testing::MockAccessibilityBridge()); |
There was a problem hiding this comment.
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
- Code should follow best practices for writing effective tests, including avoiding memory leaks and resource exhaustion. (link)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Is there a reason we dont want to also implement leftEdgeEffect and rightEdgeEffect?
|
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 Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
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. |
iOS 26 paints a scroll-edge effect (a blur and a light wash under the status bar) over any
UIScrollViewwhose content offset is non-zero. The iOS embedder keeps two scroll views underFlutterViewthat never draw anything but do sit at a non-zero offset: the scroll-to-top helper in-[FlutterViewController loadView], and aFlutterSemanticsScrollViewper 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
topEdgeEffectandbottomEdgeEffecton both views. The change is behind@available(iOS 26.0, *)and an__IPHONE_26_0SDK 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
UIScrollViewat a non-zero offset on top of it reproduces the band exactly, andtopEdgeEffect.hidden = YESremoves 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.