Skip to content

fix(dialog): lay out the content widget before drawing it - #250

Merged
kolkov merged 1 commit into
mainfrom
fix/241-dialog-content-layout
Nov 8, 2026
Merged

kolkov merged 1 commit into
mainfrom
fix/241-dialog-content-layout

Conversation

@kolkov

@kolkov kolkov commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #241.

The dialog surface drew its content without ever laying it out. A single Text looked fine because it draws from its own bounds, but a container such as primitives.HBox kept its children at empty bounds, and TextWidget.Draw returns early on those — so the user saw an empty dialog.

computeDialogBounds now lays the content out within the dialog width, and the measured height is part of the dialog height instead of the fixed padding allowance, so taller content also gets the room. Layout happens in the same place the dialog already measured its action buttons (draw time), so the overlay path keeps its current shape.

The new test builds a dialog with an HBox of two labels and draws it. On the old code it fails exactly as the issue describes: both children keep empty bounds and only the title is drawn. With the fix both labels get bounds and are drawn.

Checked locally with GOWORK=off: dialog, primitives and app tests pass, build and lint clean.

The surface drew its content without ever laying it out. A single Text
worked because it draws from its own bounds, but a container such as
primitives.HBox kept all of its children at empty bounds, so
TextWidget.Draw returned early on them and the dialog showed nothing
(#241).

computeDialogBounds now lays the content out within the dialog width,
and the measured height is part of the dialog height instead of the
fixed padding allowance. The test fails on the old code: both box
children keep empty bounds and only the title is drawn.
@codecov

codecov Bot commented Nov 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
core/dialog/widget.go 84.61% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@kolkov
kolkov merged commit 2ee4e65 into main Nov 8, 2026
12 checks passed
@kolkov
kolkov deleted the fix/241-dialog-content-layout branch November 8, 2026 13:59
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.

dialog.Content does not work with primitive.Box

1 participant