Slider cursor does not change if ensureSemantics() is called
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
Build flutter app with target webapp
1. Add `SemanticsBinding.instance.ensureSemantics();` to the main function of your application.
2. Add a [Slider widget](https://api.flutter.dev/flutter/material/Slider-class.html) on any page
3. Notice how the cursor fails to change on hover or when you interact with it.
### Expected results
Mouse cursor changes when you hover over the slider and when you interact with it.
### Actual results
Mouse cursor stays as the default pointer when you hover and interact with it.
### Code sample
Code sample
```dart
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SemanticsBinding.instance.ensureSemantics();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Namer App',
home: Scaffold(
body: Center(
child: SizedBox(
width: 500,
height: 100,
child: Slider(
value: 30,
max: 100,
onChanged: (double value) {
print('Slider value changed: $value');
},
mouseCursor: SystemMouseCursors.click),
))));
}
}
```
### Screenshots or Video
Working without ensureSemantics()
https://github.com/user-attachments/assets/f180ceb2-415a-4bb2-bc5b-ba160cb7624d
Stops working once you add ensureSemantics()
https://github.com/user-attachments/assets/08cb9953-547b-4fb1-9ac7-067cbd54ad2b
### Logs
Logs
```console
[Paste your logs here]
```
### Flutter Doctor output
Doctor output
```console
[✓] Flutter (Channel stable, 3.29.3, on macOS 15.5 24F74 darwin-arm64, locale en-US) [150ms]
• Flutter version 3.29.3 on channel stable at /Users/Alice.Wong1/fvm/versions/3.29.3
• Framework revision ea121f8859 (3 months ago), 2025-04-11 19:10:07 +0000
• Engine revision cf56914b32
• Dart version 3.7.2
• DevTools version 2.42.3
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Chrome - develop for the web [120ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] VS Code (version 1.102.1) [120ms]
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.114.0
[✓] Connected device (1 available) [6.1s]
• Chrome (web) • chrome • web-javascript • Google Chrome 138.0.7204.158
[✓] Network resources [208ms]
• All expected network resources are available.
```
Contributor guide
Assessment
This issue has not been assessed yet.