Repository navigation
Description
Steps to reproduce
- Create a TextFormField wrapped with a Semantics widget.
- Add a label and set excludeSemantics: true.
- Run on Flutter Web using flutter build web.
- Try to inspect the generated element.
- Observe that aria-label, it will come as 'Login_email' which is provided in Semantics Label
- Now set excludeSemantics: false and run the Flutter web.
- Try to inspect the generated element
- Observe the aria-label, it will come as 'Email', which is the hint text provided in the TextFormField. 'Login_email' label is not coming in this case
Tested on Chrome stable version 138.0.7204.101
Expected results
-
The should have aria-label="Login_email" so it can be used in web automation tools like Selenium/Cypress.
-
Excluding the child semantics should still allow mapping the label (i.e 'Login_email' in my case) to the native input.
Actual results
-
Input cannot be typed into programmatically (via Playwright/Selenium/Cypress) in flutter web when excludeSemantics is set to true.
-
If excludeSemantics: false, aria-label is coming as 'Email' (which is Hint text in InputDecoration of TextFormField, not the one which I am providing in labels of Semantics widget ) and input is interactive in flutter web. We can't use Hint text as semantics label as we are using language support and Hint Text can be changed based on selected language.
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
void main() {
runApp(const MyApp());
Future.delayed(const Duration(seconds: 20), () {
SemanticsBinding.instance.ensureSemantics();
});
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Semantics Bug Demo',
home: Scaffold(
appBar: AppBar(title: const Text('Semantics Bug')),
body: const Center(
child: Padding(
padding: EdgeInsets.all(16.0),
child: LoginForm(),
),
),
),
);
}
}
class LoginForm extends StatefulWidget {
const LoginForm({super.key});
@override
State<LoginForm> createState() => _LoginFormState();
}
class _LoginFormState extends State<LoginForm> {
final _formKey = GlobalKey<FormState>();
final TextEditingController _emailController = TextEditingController();
final FocusNode _emailFocusNode = FocusNode();
@override
Widget build(BuildContext context) {
return Form(
key: _formKey,
child: Semantics(
label: 'Login_email',
container: true,
excludeSemantics: true,
explicitChildNodes: true,
textField: true,
enabled: true,
child: TextFormField(
controller: _emailController,
focusNode: _emailFocusNode,
decoration: const InputDecoration(
hintText: 'Email',
),
validator: (value) {
if (_emailFocusNode.hasFocus) return null;
if (value == null || value.isEmpty) return 'Email is required';
return null;
},
),
),
);
}
}
Screenshots or Video
Logs
Logs
Launching lib\main.dart on Chrome in debug mode...
This app is linked to the debug service: ws://127.0.0.1:63316/aE8KBBVWFXo=/ws
Debug service listening on ws://127.0.0.1:63316/aE8KBBVWFXo=/ws
Connecting to VM Service at ws://127.0.0.1:63316/aE8KBBVWFXo=/ws
Connected to the VM Service.Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.0, on Microsoft Windows [Version 10.0.22631.5624], locale en-IN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.46)
X The current Visual Studio installation is incomplete.
Please use Visual Studio Installer to complete the installation or reinstall Visual Studio.
[√] Android Studio (version 2024.1)
[√] VS Code (version 1.102.0)
[√] Connected device (3 available)
[√] Network resources
! Doctor found issues in 1 category.

Activity
darshankawar commentedon Jul 16, 2025
Thanks for the report @itsnits
I tried the code sample with latest stable and master versions and observed that the
aria-label=Login_emailin intact after settingExcludeSemanticsto true and false, both.Please try by upgrading to latest sdk as there have been few fixes made related to aria label recently.
itsnits commentedon Jul 16, 2025
Thanks @darshankawar for checking this.
As confirmed by you, I have checked this with the latest stable flutter version 3.32.6.
Please check this.
Flutter doctor output
darshankawar commentedon Jul 17, 2025
Thanks for the update. Yes, I see the same behavior.
true:false:itsnits commentedon Jul 22, 2025
Hi @darshankawar,
Thanks for confirming the issue and reproducing it.
I just wanted to check on the next steps. Is there anything else required from my side to assist further?
Also, could you please let me know if a fix is planned for an upcoming release?
Appreciate your support!
11 remaining items
itsnits commentedon Sep 8, 2025
darshankawar commentedon Sep 8, 2025
@itsnits Please don't ping team members for updates and read https://github.com/flutter/flutter/blob/master/docs/contributing/issue_hygiene/README.md#comments
flutter-triage-bot commentedon Aug 25, 2026
This issue is missing a priority label. Please set a priority label when adding the
triaged-weblabel.