mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget: reset focused states when disabled
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -112,6 +112,8 @@ func (b *Clickable) Layout(gtx layout.Context, w layout.Widget) layout.Dimension
|
||||
b.click.Add(gtx.Ops)
|
||||
if !disabled {
|
||||
key.InputOp{Tag: &b.keyTag}.Add(gtx.Ops)
|
||||
} else {
|
||||
b.focused = false
|
||||
}
|
||||
c.Add(gtx.Ops)
|
||||
for len(b.history) > 0 {
|
||||
|
||||
@@ -121,6 +121,8 @@ func (e *Enum) Layout(gtx layout.Context, k string, content layout.Widget) layou
|
||||
disabled := gtx.Queue == nil
|
||||
if !disabled {
|
||||
key.InputOp{Tag: &state.tag}.Add(gtx.Ops)
|
||||
} else if e.focus == k {
|
||||
e.focused = false
|
||||
}
|
||||
semantic.SelectedOp(k == e.Value).Add(gtx.Ops)
|
||||
semantic.DisabledOp(disabled).Add(gtx.Ops)
|
||||
|
||||
Reference in New Issue
Block a user