[GH-ISSUE #612] Inexplicable mouse focus behavior #448

Closed
opened 2026-03-04 01:05:06 +03:00 by kerem · 3 comments
Owner

Originally created by @gdamore on GitHub (May 28, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/612

I'm building a form with a modal, which works fine. But when I use the mouse to click the button to dismiss the modal (or to change page), the focus seems to be lost. I've tried forcing the focus back by using app.SetFocus(), but that doesn't seem to work. The only way to get focus back on my application is to use the mouse to click on a visible component.

This isn't a huge deal, but it is confusing. I spent a lot of time trying to figure out workarounds in my application, but to no avail. I haven't debugged it further in your code.

Originally created by @gdamore on GitHub (May 28, 2021). Original GitHub issue: https://github.com/rivo/tview/issues/612 I'm building a form with a modal, which works fine. But when I use the mouse to click the button to dismiss the modal (or to change page), the focus seems to be lost. I've tried forcing the focus back by using app.SetFocus(), but that doesn't seem to work. The only way to get focus back on my application is to use the mouse to click on a visible component. This isn't a huge deal, but it *is* confusing. I spent a lot of time trying to figure out workarounds in my application, but to no avail. I haven't debugged it further in your code.
kerem closed this issue 2026-03-04 01:05:06 +03:00
Author
Owner

@rivo commented on GitHub (May 29, 2021):

Do you have some brief code that I can run to reproduce this?

<!-- gh-comment-id:850805577 --> @rivo commented on GitHub (May 29, 2021): Do you have some brief code that I can run to reproduce this?
Author
Owner

@gdamore commented on GitHub (May 29, 2021):

I figured you'd ask for this. At present I don't (part of a bigger app) but I suspect if you have a list and a modal you'd observe that after clicking the button on the modal with the mouse the focus is lost. I will see if I can put together a small reproducer this weekend.

<!-- gh-comment-id:850845683 --> @gdamore commented on GitHub (May 29, 2021): I figured you'd ask for this. At present I don't (part of a bigger app) but I suspect if you have a list and a modal you'd observe that after clicking the button on the modal with the mouse the focus is lost. I will see if I can put together a small reproducer this weekend.
Author
Owner

@rivo commented on GitHub (May 31, 2021):

I was able to reproduce this. I believe the latest commit fixes it.

<!-- gh-comment-id:851372727 --> @rivo commented on GitHub (May 31, 2021): I was able to reproduce this. I believe the latest commit fixes it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#448
No description provided.