Add scrollbar for desktop devices - #4620
Conversation
Withalion
left a comment
There was a problem hiding this comment.
Okay, so I'm not against the approach you chose it sounds good. However the idea is that if you are using MMListView component you are not supposed to know/care that it's a ListView wrapped in ScrollView or that you need to wrap it again in ScrollView. The API for MMListView should stay the same and if necessary the component needs to deal with scrollbar internally.
Fair point, didn't think of this. Reverted files to their master version and updated |
…ar-for-desktop-lists
Coverage Report for CI Build 32839190682Warning No base build found for commit Coverage: 59.074%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
📦 Build Artifacts Ready
|
Description
Adds a proper scrollbar for desktop builds. Mobile builds rely on touch/flick scrolling and never had or needed a visible scrollbar, but on desktop there was no scroll indicator at all, and once turned on in
ScrollViewit was drawn over the left side of content instead of reserving space for itself.ListViewbased lists had no scrollbar handling at all, so the same content-overlap problem applied there too, across many pages.Fixes: #4127
Original PR: #4145
Problem
The obvious first approach was to just declare
ScrollBar.verticaldirectly on the sharedMMListViewcomponent, sinceListView/Flickableauto-positions an attached scrollbar correctly on its own. The problem is that aListView's scrollbar is drawn as an overlay on top of its content -Flickablehas no concept ofpaddingthe way aControldoes, so there's nothing built in to reserve space for it.In practice, that meant every delegate, header, footer, and section-delegate across the ~17 different lists in the app would need to know a scrollbar might be there and manually subtract its width from their own sizing to avoid being drawn underneath it. That's a lot of duplicated logic to keep in sync, easy to miss in a new or existing list, and it still didn't cover every case cleanly (e.g. footers/section headers don't automatically inherit a delegate's width-adjustment logic, so each one needed the same fix repeated separately). Wrapping each list in
MMScrollViewinstead moves that reservation into one realpaddingvalue on aControl, so no list, delegate, or header needs to know a scrollbar exists at all.What changed
rightPaddingto the sharedMMScrollViewcomponent so the scrollbar reserves its own space instead of overlapping content, headers, footers, etc.ListViewin the app (via the sharedMMListViewcomponent) inMMScrollView, rather than handling scrollbars per-list.ScrollViewis able to reuse aListViewas its own scrollable content directly, so this didn't require a rewrite of any list, just a wrapper, and now every list in the app shares the exact same scrollbar behavior and styling from one place instead of duplicating it.Behaviour
Desktop - scrollbar visible, correctly positioned on the right edge, content no longer drawn underneath it:
Desktop - scrollbar hides and shows as needed:
Screencast.From.2026-07-22.18-38-09.webm
Mobile — no scrollbar shown, touch scrolling behaves exactly as before: