2
0
mirror of https://github.com/rivo/tview.git synced 2024-11-15 06:12:46 +00:00

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

This commit is contained in:
Oliver 2021-05-31 12:46:47 +02:00
parent 2003bc0698
commit 807e706f86

View File

@ -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
}