Repository navigation
Description
Use case
When a multiline TextField displays a scrollbar, the mouse cursor remains as an I-beam (text cursor) when hovering over the scrollbar thumb and track. Users expect the cursor to change to a default arrow pointer when hovering over a scrollbar, matching native platform behavior on desktop and web.
The root cause is in RawScrollbarState.build() (scrollbar.dart, line 2235): the MouseRegion wrapping the scrollbar content has no cursor parameter, defaulting to MouseCursor.defer. This defers cursor resolution to the parent widget — in the case of TextField, that parent is a MouseRegion(cursor: SystemMouseCursors.text) (text_field.dart, line 1785), which covers the entire widget including the scrollbar zone.
The scrollbar has no separate hit-test target — it is painted via CustomPaint.foregroundPainter on top of the child content. Because Flutter's cursor resolution picks the first non-defer MouseRegion in hit-test order (inner to outer, mouse_cursor.dart, line 262), there is no way for consumers to override the cursor specifically for the scrollbar area without subclassing and forking the entire RawScrollbarState.build() method.
Alternatives considered:
We tested 8 workaround approaches including ScrollBehavior wrappers, custom RawScrollbar subclasses, Stack overlays, TextField.mouseCursor overrides, and direct DOM cursor manipulation (for Flutter web/CanvasKit). All fail because:
- External wrappers are outer to
TextField'sMouseRegionin the widget tree, so they lose cursor resolution - Internal wrappers (via
ScrollBehavior.buildScrollbar) only cover the content area, not theTextFieldpadding zone where the scrollbar is visually rendered TextField.mouseCursoroverride changes cursor for both the text area and scrollbar — losing the I-beam for text editing
Full investigation with POC code: https://github.com/ds-vitse/spike-scrollbar-cursor-ligui-3465
No major Flutter UI library has solved this (checked: fluent_ui, macos_ui, shadcn_flutter — all extend RawScrollbar and inherit the same limitation).
Related issues: #58192 (add mouse cursor support to remaining widgets), #88371 (themable mouse cursors)
Proposal
Add a mouseCursor property to RawScrollbar and ScrollbarThemeData, similar to how other interactive widgets expose cursor customization.
Minimal change in RawScrollbarState.build() at scrollbar.dart, line 2235:
// Current:
child: MouseRegion(
onExit: ...
onHover: ...
// Proposed:
child: MouseRegion(
cursor: widget.mouseCursor ?? MouseCursor.defer,
onExit: ...
onHover: ...Additionally, ScrollbarThemeData should support a mouseCursor property (consistent with #88371), and the Material Scrollbar should resolve it from the theme.
An ideal implementation would use isPointerOverScrollbar() to apply the cursor only when the pointer is over the scrollbar track/thumb, not the entire content area — keeping the parent widget's cursor (e.g. I-beam for TextField) for the content area.
Flutter version: 3.35.7 (Dart 3.9.2), verified against master branch source.
Activity
Add mouseCursor to RawScrollbar
Add mouseCursor to RawScrollbar
Add mouseCursor to RawScrollbar
vitamin33 commentedon Apr 30, 2026
Closed in favor of #185811 with a simplified description.
vitamin33 commentedon Apr 30, 2026
Closing in favor of #185811 with a simplified description and screen recording.
ds-vitaliise commentedon Apr 30, 2026
Duplicate of #185813
Add mouseCursor to RawScrollbar
Add mouseCursor to RawScrollbar
Add mouseCursor to RawScrollbar
Add mouseCursor to RawScrollbar
Add mouseCursor to RawScrollbar
Add mouseCursor to RawScrollbar
github-actions commentedon May 14, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.