Forms cannot rely purely on a rect check for mouse clicks as drop-downs may extend beyond it. Fixes #602

pull/616/head
Oliver 3 years ago
parent 2003bc0698
commit 807e706f86

@ -621,10 +621,6 @@ func (f *Form) focusIndex() int {
// MouseHandler returns the mouse handler for this primitive.
func (f *Form) MouseHandler() func(action MouseAction, event *tcell.EventMouse, setFocus func(p Primitive)) (consumed bool, capture Primitive) {
return f.WrapMouseHandler(func(action MouseAction, event *tcell.EventMouse, setFocus func(p Primitive)) (consumed bool, capture Primitive) {
if !f.InRect(event.Position()) {
return false, nil
}
// At the end, update f.focusedElement and prepare current item/button.
defer func() {
if consumed {
@ -651,7 +647,7 @@ func (f *Form) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
// A mouse click anywhere else will return the focus to the last selected
// element.
if action == MouseLeftClick {
if action == MouseLeftClick && f.InRect(event.Position()) {
consumed = true
}

Loading…
Cancel
Save