Repository navigation
Description
Steps to reproduce
flutter create --platforms ios bug, then replacelib/main.dartandios/Runner/AppDelegate.swiftwith the code sample below. It shows a bareUISegmentedControlin aUiKitViewtwice: once outside any scrollable, once as the first child of aListView.- Run it on an iOS simulator.
- Run the UI test below in a UI-testing bundle targeting the app (
XCUIApplication(bundleIdentifier:)). It prints each segment's frame andisHittable.
Expected results
Every segment is hittable, inside the ListView as well as outside it.
Actual results
Outside the list every segment is hittable. Inside the list no segment is, though each has a real frame and the segmented control itself reads hittable:
REPRO control0 frame=(16.0, 78.0, 210.0, 32.0) hittable=true
REPRO control0 segment0 label=Out1 frame=(16.0, 78.0, 70.0, 32.0) hittable=true
REPRO control0 segment1 label=Out2 frame=(86.0, 78.0, 70.0, 32.0) hittable=true
REPRO control0 segment2 label=Out3 frame=(156.0, 78.0, 70.0, 32.0) hittable=true
REPRO control1 frame=(16.0, 142.0, 370.0, 32.0) hittable=true
REPRO control1 segment0 label=In1 frame=(16.0, 142.0, 123.0, 32.0) hittable=false
REPRO control1 segment1 label=In2 frame=(139.0, 142.0, 123.0, 32.0) hittable=false
REPRO control1 segment2 label=In3 frame=(262.0, 142.0, 124.0, 32.0) hittable=false
The window's accessibility hit test at an in-list segment's centre returns the list's FlutterSemanticsScrollView; outside the list it returns the UISegment. VoiceOver touch exploration goes through the same hit test, so a VoiceOver user cannot touch a single segment inside a scrolling list (VoiceOver itself was not run, the simulator has none). A UISwitch and a UISlider in the same list stay hittable.
Root cause (engine at 5f77625673248ee5846fbcaf5d3e1a3878386fd7):
SemanticsObject.mm:567_accessibilityHitTest:withEvent:returns[self search:point], andsearch:(:543) returns the first node holding the point thatisFocusable.isFocusable(:468) is true for any action outsidekScrollableSemanticsActions(:480). That mask (lib/ui/semantics/semantics_node.h:60) covers scroll up/down/left/right but notscrollToOffset, which everyScrollablesets since Add handler forSemanticsAction.scrollToOffset#159811. AListView's node carriesscrollToOffset | scrollUp(actions=8388624in a widget test at the same revision), so the list counts as focusable.- The platform view's node has no label or action, so
search:skips it and returns the scroll node. The platform view's own subtree is never asked.
Related: #164483 (fixed by #184155) made FlutterSemanticsScrollView stop being an element without a label; this case still reproduces after that fix.
Code sample
Code sample
lib/main.dart:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(const ReproApp());
class ReproApp extends StatelessWidget {
const ReproApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.all(16),
child: _Segmented(titles: ['Out1', 'Out2', 'Out3']),
),
Expanded(
child: ListView(
padding: const EdgeInsets.all(16),
children: [
const _Segmented(titles: ['In1', 'In2', 'In3']),
for (var i = 0; i < 40; i++) ListTile(title: Text('Row $i')),
],
),
),
],
),
),
),
);
}
}
class _Segmented extends StatelessWidget {
const _Segmented({required this.titles});
final List<String> titles;
@override
Widget build(BuildContext context) {
return SizedBox(
width: 210,
height: 32,
child: UiKitView(
viewType: 'segmented',
creationParams: titles,
creationParamsCodec: const StandardMessageCodec(),
),
);
}
}ios/Runner/AppDelegate.swift:
import Flutter
import UIKit
@main
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
let registrar = engineBridge.pluginRegistry.registrar(forPlugin: "SegmentedRepro")!
registrar.register(SegmentedFactory(), withId: "segmented")
}
}
final class SegmentedFactory: NSObject, FlutterPlatformViewFactory {
func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?)
-> FlutterPlatformView
{
SegmentedView(titles: args as? [String] ?? ["A", "B", "C"])
}
func createArgsCodec() -> any FlutterMessageCodec & NSObjectProtocol {
FlutterStandardMessageCodec.sharedInstance()
}
}
final class SegmentedView: NSObject, FlutterPlatformView {
private let control: UISegmentedControl
init(titles: [String]) {
control = UISegmentedControl(items: titles)
control.selectedSegmentIndex = 0
}
func view() -> UIView { control }
}UI test:
import XCTest
final class SegReproUITests: XCTestCase {
func testSegmentHittability() throws {
let app = XCUIApplication(bundleIdentifier: "com.example.bug")
app.launch()
XCTAssertTrue(app.segmentedControls.firstMatch.waitForExistence(timeout: 30))
Thread.sleep(forTimeInterval: 2)
for i in 0..<app.segmentedControls.count {
let control = app.segmentedControls.element(boundBy: i)
print("REPRO control\(i) frame=\(control.frame) hittable=\(control.isHittable)")
for j in 0..<control.buttons.count {
let segment = control.buttons.element(boundBy: j)
print(
"REPRO control\(i) segment\(j) label=\(segment.label) frame=\(segment.frame)"
+ " hittable=\(segment.isHittable)")
}
}
}
}Flutter Doctor output
Doctor output
[!] Flutter (Channel stable, 3.47.0, on macOS 27.0.1 26A434 darwin-arm64, locale en-US) [160ms]
• Flutter version 3.47.0 on channel stable at /Users/macmini/fvm/versions/3.47.0
! The flutter binary is not on your path. Consider adding /Users/macmini/fvm/versions/3.47.0/bin to your path.
! The dart binary is not on your path. Consider adding /Users/macmini/fvm/versions/3.47.0/bin to your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cf2416426 (9 weeks ago), 2026-08-11 11:53:49 -0700
• Engine revision 5f77625673
• Dart version 3.13.0
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✗] Android toolchain - develop for Android devices [114ms]
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/macos-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[!] Xcode - develop for iOS and macOS (Xcode 27.0) [1,315ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 27A266a
! CocoaPods not installed.
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) [4ms]
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Connected device (2 available) [6.3s]
• xui-n3-27b (mobile) • 457A2341-0261-4459-ADE9-C29BB865DB3C • ios • com.apple.CoreSimulator.SimRuntime.iOS-27-0 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 27.0.1 26A434 darwin-arm64
[✓] Network resources [479ms]
• All expected network resources are available.
! Doctor found issues in 4 categories.
Activity
saurabh-mirajkar commentedon Oct 15, 2026
@uwuclxdy Thanks for the report. Reproduced on the iOS 27.0 simulator using the provided sample and latest stable Flutter 3.47.7. Routing this to the team for further investigation.
Relevant test output
uwuclxdy commentedon Oct 18, 2026
Two more findings on the same engine revision (
5f77625673, Flutter 3.47.0, iOS 27.0 simulator), from an app withUISwitch,UIButtonand pop-upUIButtonplatform views in aListView:UISwitchreading hittable doesn't mean it's reachable._accessibilityHitTest:withEvent:at its centre returns theFlutterSemanticsScrollView, as for the segments, andaccessibilityActivateon that returnsNOwith nothing toggled (3/3 launches). XCUITest'sisHittablereadstruethere anyway, so it isn't a usable signal for this bug, and the switch is affected as much as the segments.Textsharing the list child with the platform view merges its label into that child's node, sosearch:returns that node at every point inside the child (362x397pt in my case). The hit test lands on a static text block covering the controls, andaccessibilityActivateon it returnsNOtoo.Wrapping each
UiKitViewin aSemanticsnode with the control's label, value and anonTapthat drives the native control, and setting the native view'saccessibilityElementsHidden, works around both:search:returns that node at the control's rect and activating it runs the action (3/3 launches). So imo the fix belongs insearch:: when the point falls inside a platform view's node, it could return the native view's own accessibility hit test instead of skipping it.hannah-hyj commentedon Oct 21, 2026
From a11y triage: I think this is maybe a P2 because only hit test is affected but not traversal.
spencerchase11-ops commentedon Nov 21, 2026
The same root cause also affects plain Flutter content, with no platform view. In a
ListViewwith space between its items, a VoiceOver touch in that space focuses the whole list. The Caption Panel shows nothing new, because the list has no label.Repro. A fresh
flutter createapp (below): aListView.separatedof 48 pt items with 48 pt gaps. Debug build, iOS 27.0 Simulator (iPhone 18 Pro). VoiceOver runs in this Simulator (Settings > Accessibility > VoiceOver), and its Caption Panel shows what it speaks.The result is the same on 3.44.4, 3.50.0 and 3.50.1.
Why. The list's node has no label and has
scrollUp | scrollToOffset(actions=8388624in a widget test). On 3.50.1,kScrollableSemanticsActions(lib/ui/semantics/semantics_node.h:60-61) does not includekScrollToOffset, so-[SemanticsObject isFocusable](SemanticsObject.mm:525-538) is true for the list.search:(:604-618) then returns the list for any point inside it that no item covers. A widget test that applies this rule to the list'sSemanticsDatafails on 3.44.4, 3.50.0 and 3.50.1, and passes with the master mask. It models the engine rule. It is not engine code.Master. #195731 adds
kScrollToOffsetto the mask (semantics_node.h:60-62on master, 5423f94), and the rule moved to-isAccessibilityElement(SemanticsObject.mm:535-560). That should fix this case. I could not run a master engine to confirm it. Its 3.50 cherry-pick, #196163, is still a draft. I did not check whether #195731 also fixes the platform view case in this issue.lib/main.dart
test/gap_focus_test.dart (a model of the engine rule)
Test output on 3.50.1 (excerpt)
The second test, with the master mask, passes. 3.44.4 and 3.50.0 print the same.