widget: reset focused states when disabled

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-02-28 18:17:06 +01:00
parent 50e35c9c3f
commit 79bfd3adbd
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -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)