-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix mod search box not tracking external changes to focus state #27780
Fix mod search box not tracking external changes to focus state #27780
Conversation
In the Mod selection area, the search bar's focus could be changed by pressing TAB. However, when clicking outside of the search bar, the focus would be killed but two TABs were required to get the focus back on the search bar. This happened because the action of clicking in an empty area would trigger the search bar to change its appearence, but not its internal state. In my solution, I made the OnClick function aware of the search bar's state, so it would not only change its appearance, but also its state. Now, after clicking in an empty area, there is only needed one TAB to select the search box again, as expected.
@@ -953,7 +957,7 @@ protected override bool OnClick(ClickEvent e) | |||
RequestScroll?.Invoke(this); | |||
|
|||
// Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action. | |||
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null)); | |||
modSelectOverlayInstance.setTextBoxFocus(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach is insufficient. It only fixes the bug in the case wherein clicking the columns was specifically what took focus away from the textbox.
If any other component, such as the chat overlay, happens to take away focus, this stops working:
2024-04-05.10-41-36.remuxed.mp4
Note how after opening chat, it takes two tab presses to focus the textbox again.
The actual fix will probably involve looking at the actual focus state of the textbox rather than doing tracking in a separate flag.
I pretty much rewrote this but it's also such a minor change that I'm not going to request a second check, just going to roll forward with it. |
In the Mod selection area, the search bar's focus could be changed by pressing TAB. However, when clicking outside of the search bar, the focus would be killed but two TABs were required to get the focus back on the search bar. This happened because the action of clicking in an empty area would trigger the search bar to change its appearence, but not its internal state. In my solution, I made the OnClick function aware of the search bar's state, so it would not only change its appearance, but also its state. Now, after clicking in an empty area, there is only needed one TAB to select the search box again, as expected.