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

+1 -1
View File
@@ -25,7 +25,7 @@ func Toggle(c *ui.Context, on *bool, label string, opts ToggleOptions) *ui.Eleme
}
var b *ui.Element
ui.Row(c).Shrink(0).Disabled(opts.Disabled).Children(func() {
b = ui.ToggleBase(c, choiceTarget(on, opts.Disabled))
b = ui.ToggleBase(c, on)
})
if b.Changed() {
slog.Debug("mujica: toggle changed", "label", label+opts.Label, "on", *on)