Repository navigation
Description
Steps to reproduce
- Run the sample below with
flutter run -d chrome. - The field has the focus. Type
abcwithin 5 seconds. - After 5 seconds, type
d.
The sample calls SemanticsBinding.instance.ensureSemantics(). Without that line, everything works. An app without it gets the same bug as soon as a user activates Flutter web's hidden "Enable accessibility" button.
Expected results
The field shows abcd.
Actual results
The field shows d. The text typed before the semantics change is erased, and onChanged reports an empty string before the d. The field keeps the focus.
The sample turns on a Semantics(container: true) above the field after 5 seconds, which merges the field's semantics into a new node.
What I think happens: the field now belongs to a new semantics node, so the engine creates a new SemanticTextField with an empty <input>. Once the editing strategy uses that element, it reads its empty value and sends it to the framework as the editing state, which replaces the controller's text.
Code sample
Code sample
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SemanticsBinding.instance.ensureSemantics();
runApp(
const MaterialApp(
home: Scaffold(
body: Padding(padding: EdgeInsets.all(24), child: Sample()),
),
),
);
}
class Sample extends StatefulWidget {
const Sample({super.key});
@override
State<Sample> createState() => _SampleState();
}
class _SampleState extends State<Sample> {
bool _container = false;
@override
void initState() {
super.initState();
// Merges the field's semantics into a new container node.
Timer(const Duration(seconds: 5), () => setState(() => _container = true));
}
@override
Widget build(BuildContext context) {
return Semantics(
container: _container,
child: const TextField(
autofocus: true,
decoration: InputDecoration(hintText: 'Type a few characters'),
),
);
}
}Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.47.7, on macOS 27.0.1 26A434 darwin-arm64, locale en-US)
• Flutter version 3.47.7 on channel stable at /Users/gringo/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision abaf9c5237 (2 weeks ago), 2026-10-08 09:51:21 -0700
• Engine revision deb287481e
• Dart version 3.13.5
• DevTools version 2.60.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 27.0.1 26A434 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 155.0.8059.85
Activity
suryaKommana2662 commentedon Oct 26, 2026
@nogringo I was able to reproduce the issue on Flutter Web using Chrome on Flutter 3.47.7 stable. After entering
abc, the text field was cleared when the semantics node changed after 5 seconds. Typingdafterward displayed onlydinstead ofabcd. Routing this to theteam-accessibilityfor further investigation.Flutter Doctor Output
flutter-zl commentedon Oct 28, 2026