nheko
nheko copied to clipboard
focus does not return to chat box after opening and closing chat switcher
Describe the bug
when opening and then closing the chat switcher without actually switching chats, focus does not return to the chat box. if the switcher is used to switch to the current chat, the issue persists
the only way to get focus back into the chat box without using the mouse is to switch to another chat and then back to the one you want
To Reproduce
- have a chat open
- open up the switcher with control-k
- close the switcher with the escape key
- focus does not return to the chat box
What happened?
No response
Expected behavior
when closing the switcher or switching to the current chat, focus should return to the input box as it does when switching to another chat with the switcher
Screenshots
No response
Version
0.9.3
Operating system
Linux
Installation method
Local build
Qt version
5.15.2
C++ compiler
g++ 10.2.1
Desktop Environment
xfce
Did you use profiles?
- [ ] Profiles used?
Relevant log output
No response
Backtrace
No response
I think focus isn't entirely broken, but there are hundreds(?) of useless focusable items, with no focus indicator, nearly keyboard bindings (though pressing Space does sometimes popup dialogs), and no shortcut to return focus to the chat box.
After opening and closing Ctrl+K, I found that pressing Shift+Tab moves focus instantly to the chat box. Otherwise you have to hold Tab for multiple seconds (essentially spamming dozens to hundreds of Tab presses) to focus the chat box. I'm deducing that the chat box is the last focusable item of hundreds(?), and closing Ctrl+K moves focus to the first focusable item, and Shift+Tab wraps around to the last one.
Additionally, with the chat box focused, pressing Shift+Tab defocuses it with no clear "next focused item". Pressing Tab once focuses the chat box again. Similarly with pressing Shift+Tab twice then Tab twice. And holding Shift+Tab for multiple seconds focuses the chat box again. I'm deducing that there is a currently focused element out of a fixed (for a given chat assuming no new messages) list tracked internally, but not shown in the UI.
Clicking the most recent message requires 1 Tab press to reach the chat box. Clicking the second most recent one requires many many Tab presses, or two Shift+Tab presses. Clicking the third most recent one requires five Shift+Tab presses. I'm deducing that chat messages act as focusable items, but in a pseudo-random order (possibly related to messages sent before or after opening the chat?).
Visualizing focus
I tried running nheko in GammaRay, but Void Linux's GammaRay won't show a list of Flatpak nheko's Qt Quick items, and Arch Linux's crashes every time I close the user picker (after pressing Tab in the text field), sometimes when resizing the window, and sometimes when moving focus, or plain randomly. GammaRay is just so unstable and unreliable...
On Arch Linux, I was able to debug focus. I had to avoid opening the Tab user picker, open GammaRay to the "Quick Scenes" tab, switch the dropdown on top to "MainWindow", and start moving focus around. I saw the item tree view glow in purple indicating focus moving around. In fact, after pressing and closing Ctrl+K, I saw the top bar's buttons gaining focus, and in some cases pressing Space would open a dialog. In other cases, focus moved to the "scroll to bottom" button (even when hidden) or messages.
Suggestions
- Add a visible focus indicator when Tab keypresses (rather than clicking) moves focus, like in Discord (and Element to an extent). (I don't like how Element randomly surrounds elements in Chrome's orange focus indicator though.)
- Bind Esc to move focus back to the text box, like in Discord and Element.