-
-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouse click on InputField sets Focus to inner TextArea #1020
Comments
I discovered a bug when calling Box.MouseHandler() instead of textArea.MouseHandler(). The issue occurs when you first click to focus on an InputField, and then try to focus on a different InputField. The first field remains focused because the textArea's Box retains the focus, resulting in any typing still happening in the first InputField. Therefore, this solution doesn't work as intended. Do you have any suggestions on how to resolve this issue? |
The latest commit should fix the issue with the focus callback. Regarding your second issue, can you please post a brief code snippet that I can run to reproduce it? |
Thanks, your commit really solved my problem! To reproduce the second issue, you can use this example code:
You also need to make some changes to the
To be clear, here is the To reproduce the issue, follow these steps:
|
This problem doesn't happen for me in the current version, at least not with the steps you listed. So unless you can demonstrate that it still exists in the latest version, I will consider this issue as "resolved". |
When using InputField, I've encountered an issue where clicking on the field with the mouse sets the focus to the inner TextArea rather than the InputField itself or its Box. This behavior prevents SetFocusFunc method from being triggered as expected.
Below is the code I am using to create an InputField. For brevity, the header and dialogue setup have been omitted::
It seems like issue arises because InputField's MouseHandler calls the TextArea's mouse handler (https://github.com/rivo/tview/blob/master/inputfield.go#L670), resulting in the TextArea gaining focus. To resolve this, I think we need to call to Box.MouseHandler() instead to ensure the InputField.Box.focus is properly triggered on mouse click.
The text was updated successfully, but these errors were encountered: