Skip to content

fix(ui): keep the wheel over a Popover, Dialog or modal Drawer in the panel - #40

Merged
xiaoyumuxi merged 1 commit into
mainfrom
fix/popover-wheel-stays-in-panel
Nov 18, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
fix/popover-wheel-stays-in-panel

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Nov 18, 2026 •

Copy link
Copy Markdown

What this changes

A wheel over an open Popover's panel, a Dialog or a modal Drawer is now the panel's:

  • view.Wheel looks 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.Wheel applies 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 (listWheelX takes the panel). Inside a panel they still scroll; under it they do not. Over a panel, the event no longer falls through to Config.OnScroll, unless the pointer is over a ScrollAt area, whose wheel stays the application's, as before.
  • Beside a Popover the page scrolls as before: a Popover is not modal. A non-modal Drawer and an application's Overlay (whose docs leave the wheel to the application) keep the routing they had.

Why

view.Wheel walked 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 the cmd/viva packaging tests, which fail identically on 059256b without 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, app and components also pass merged onto the latest upstream main (5534f58).
  • platform vet: go vet -tags vivahead ./internal/platform/darwin ./headless/..., and GOOS=windows / GOOS=linux go vet ./internal/... ./app/
  • benchmarks before and after: there is no wheel benchmark, so a throwaway one (not committed) called view.Wheel on 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.
  • stripped binary size: not affected (no new dependencies)
  • a real window: not run; the tests below drive the page through app.Driver.Scroll

New 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.

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant