Refactor: a disabled wrapper alone blocks choice bases

TestBasesBlockedByDisabledWrapper focuses CheckboxBase, RadioBase,
SwitchBase and ToggleBase, flips their wrapper to Disabled and presses
Space: none changes its value, and each does without the flip. So
choiceTarget goes from Switch, Toggle and MultiSelect, and PopupMenu
Check drops its copy; TestChoiceDisabledWhileFocused and
TestDropdownMenuCheckDisabledThisFrameKeepsValue still pass.

ComboboxBase is different: TestComboboxBaseIgnoresDisabledWrapper shows
a focused one still takes typing under a disabled wrapper, so Combobox
keeps a copy, now inline as its only user.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 13:47:09 -04:00
1 parent 0651debf9d
commit dbed3b603f
6 files changed
+70 -22

No files matched your search

+2 -2
View File
@@ -180,9 +180,9 @@ func multiSelectPopup[T comparable](c *ui.Context, k theme.Tokens, values *[]T,
func multiSelectCheck(c *ui.Context, k theme.Tokens, on *bool, st internal.CheckState, label string, disabled bool) *ui.Element {
d := Density(c)
var cb *ui.Element
// A disabled wrapper and a copy block the base, which toggles as it is built.
// A disabled wrapper blocks the base, which toggles as it is built.
ui.Row(c).Grow(1).Disabled(disabled).Children(func() {
cb = ui.CheckboxBase(c, choiceTarget(on, disabled)).MinHeight(d.ControlHeight()).Padding(0, d.Unit()*2).
cb = ui.CheckboxBase(c, on).MinHeight(d.ControlHeight()).Padding(0, d.Unit()*2).
Gap(d.Unit() * 2).AlignItems(ui.Center).Radius(theme.ControlRadius).Grow(1)
})
if st == internal.Mixed {