%button layout/sizing bug
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 68
- Forks
- 82
- PR merge metrics
- No merged PRs in 30d
Description
The following demonstrates a subtle %button layout/sizing bug, which results in multi-line %button's being wider, and given proportionately less horizontal margin, than its single-line counterpart.
(when run under macos 13.2.1)...
#lang racket/gui
(define dialog (instantiate dialog% ("X")))
(define hpanel-1 (new horizontal-panel% [parent dialog] [horiz-margin 0]))
(new button% [parent hpanel-1] [label "X"]) ; much wider than it need be
(new button% [parent hpanel-1] [label "X"])
(new button% [parent hpanel-1] [label "X"])
(define hpanel-2 (new horizontal-panel% [parent dialog] [horiz-margin 0]))
(new button% [parent hpanel-2] [label "XXXX"]) ; max text prior to stretching
(new button% [parent hpanel-2] [label "XXXX"])
(new button% [parent hpanel-2] [label "XXXX"])
(define hpanel-4 (new horizontal-panel% [parent dialog] [horiz-margin 0]))
(new button% [parent hpanel-4] [label "X\nX"]) ; wider with less margin
(new button% [parent hpanel-4] [label "X\nX"])
(new button% [parent hpanel-4] [label "X\nX"])
(define hpanel-5 (new horizontal-panel% [parent dialog] [horiz-margin 0]))
(new button% [parent hpanel-5] [label "XXXXX\nXXXXX"]) ; max text prior to stretching
(new button% [parent hpanel-5] [label "XXXXX\nXXXXX"])
(new button% [parent hpanel-5] [label "XXXXX\nXXXXX"])
(send dialog show #t)
I personally prefer the less default margin associated with the multi-line %button; but would also strongly prefer their min-width be reduced to being no larger the min-height of the button (for a single line button), and thereby can be as small as required to be square and display a single character (or Nx1 chars for multi-line buttons, and thereby be N x taller than wide); and the horiz-margin around the label be reduced to be only slightly more than apparently allocated for its vert-margin, seemingly being only a few pixels or so (or whatever required to enable the smallest square button to cleanly display a single character).
This is related to the prior feature request #290.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided %button and horizontal-panel% reproduction under macOS 13.2.1, then trace the button sizing and margin behavior. Done means multiline buttons no longer receive excessive minimum width, can become as narrow as their content allows, and retain clean margins comparable to single-line buttons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100