Repository navigation
fix(ui): keep the wheel over a Popover, Dialog or modal Drawer in the panel - #40
Merged
Merged
Conversation
… panel The wheel went to the last declared ScrollArea under the pointer, whatever was painted over it. A Popover hanging off a title bar is declared before the page below it, so a wheel over the panel's list scrolled the tree under the panel first, and over the panel's padding, or with its list at its end, the wheel went through to the page. A Modal let the page under its scrim scroll the same way, and a self-scrolling Table, a TextArea or a List's sideways wheel under a panel took the wheel too. Over an open Popover's panel, a Dialog or a modal Drawer, only what is declared inside the panel takes the wheel now: its ScrollAreas, Tables, TextAreas and Lists. An event none of them takes stops at the panel, handled, unless the pointer is over a ScrollAt area, whose wheel stays the application's. Beside a Popover the page scrolls as before. A non-modal Drawer and an application's Overlay keep the routing they had.
xiaoyumuxi
marked this pull request as ready for review
November 18, 2026 09:17
This was referenced Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
A wheel over an open Popover's panel, a Dialog or a modal Drawer is now the panel's:
view.Wheellooks for the topmost such panel under the pointer (frame.wheelPanel, the floats from the last painted down) and offers the wheel only to the ScrollAreas declared inside it (frame.wheelArea). An event none of them can use stops at the panel, handled.Page.Wheelapplies the same rule to everything else it routes: self-scrolling Tables (tableRoute.root), TextAreas (fieldEntry.box) and the sideways wheel of a List with RowWidth (listWheelXtakes the panel). Inside a panel they still scroll; under it they do not. Over a panel, the event no longer falls through toConfig.OnScroll, unless the pointer is over a ScrollAt area, whose wheel stays the application's, as before.Overlay(whose docs leave the wheel to the application) keep the routing they had.Why
view.Wheelwalked the nodes from the last declared to the first and gave the wheel to the first ScrollArea under the pointer that could move, whatever was painted on top of it. A Popover that hangs off a title bar button is declared before the page under it, so in Lithe, scrolling the project list in the title bar's project popover scrolled the project tree underneath first. Only once the tree reached its end did the list move. Over the panel's padding, or with its list at its end, the wheel went through to the tree. The same happened under a Modal's scrim, and to a Table, a TextArea or a List's sideways wheel under any of these panels.How it was verified
test -z "$(gofmt -l $(git ls-files '*.go'))"go vet ./...go test ./... -count=1: everything passes except thecmd/vivapackaging tests, which fail identically on059256bwithout this change on this machine ("the program was built for macOS 13.0 or later but [mac] min_system says 12.0"; the macOS 27 SDK's deployment target).ui,appandcomponentsalso pass merged onto the latest upstreammain(5534f58).go vet -tags vivahead ./internal/platform/darwin ./headless/..., andGOOS=windows/GOOS=linuxgo vet ./internal/... ./app/view.Wheelon a page of ten ScrollAreas of 50 rows each, with no panel open (Apple M4,-count=5, interleaved): before 226–236 ns/op, after 239–251 ns/op, 0 allocs both. The extra ~10–15 ns is the search for a panel among the floats. With a panel open, the search starts at the panel's root, so it scans fewer nodes.app.Driver.ScrollNew tests in
ui/popover_wheel_test.go, each failing without the change:TestAWheelOverAPopoverStaysInThePanel: a Popover declared before a page ScrollArea under it. The wheel scrolls the panel's list and not the page. At the list's end and over the panel's padding the page stays put. Beside the panel the page scrolls.TestATableInAPopoverTakesTheWheelAndTheTableUnderItDoesNot: a self-scrolling Table in a Popover takes the wheel, and the Table under the panel does not, even past the panel table's end. Beside the panel the page's Table scrolls.TestAWheelOverAModalLeavesThePageUnderIt: with a Modal open, a wheel over its surface or its scrim does not scroll the page.Where the boundary sits
Framework capability: which element the wheel reaches is the page's routing, and a panel Viva paints over the page is opaque to presses (
Canvas.Block) already. This makes it opaque to the wheel the same way.Upstream
The same branch is proposed upstream as vivaui#349.