widget: treat enter and space as clicks on release, not press

Matches the usual behaviour of GUI toolkits.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-02-28 14:28:22 +01:00
parent 21431975de
commit aaf457d6e1
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ func (e *Enum) Layout(gtx layout.Context, k string, content layout.Widget) layou
e.focused = false
}
case key.Event:
if ev.State != key.Press {
if ev.State != key.Release {
break
}
if ev.Name != key.NameEnter && ev.Name != key.NameSpace {