Skip to content

Commit c0db304

Browse files
hajimehoshicodex
andcommitted
debugui: require current hover to focus widgets
Assign focus only when the pointer is currently over the widget, and clear stale hover when the pointer leaves. This prevents an outside press from restoring focus and reopening a dropdown in the same update. Closes #58 Co-Authored-By: Codex <noreply@openai.com>
1 parent 6fd8cf0 commit c0db304

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎widget.go‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,10 @@ func (c *Context) handleInputForWidget(id widgetID, bounds image.Rectangle, opt
105105
}
106106
}
107107

108-
if c.hover == id {
109-
if c.pointingJustPressed() {
110-
c.setFocus(id)
111-
} else if !hover {
112-
c.hover = widgetID{}
113-
}
108+
if hover && c.pointingJustPressed() {
109+
c.setFocus(id)
110+
} else if c.hover == id && !hover {
111+
c.hover = widgetID{}
114112
}
115113

116114
return

0 commit comments

Comments
 (0)