window(core): disable text input focus and cursor when popup closes#11005
window(core): disable text input focus and cursor when popup closes#11005Murmele wants to merge 3 commits intoslint-ui:masterfrom
Conversation
Disable text input focus and cursor state when a popup is closed to ensure a clean UI state. This prevents lingering cursor visibility and input focus issues after popup dismissal. - Explicitly set text input focus to `false` for the window - Disable input method for the window adapter when available - Maintain existing dirty region and redraw logic for popup updates Fixes slint-ui#11004
ogoffart
left a comment
There was a problem hiding this comment.
Thanks.
Is it possible to make a test for this?
I'm wondering if this is something that is specific with the popup or has the problem also for any component destruction.
For example:
if condition: LineEdit {}When condition becomes false when the LineEdit has the focus, is there not the same bug?
I would hope that the general existing focus handing code would take care of this. And maybe that is actually the bug.
|
In general the TextInput gets the FocusOut event when it looses focus and therefore the cursor will be hidden (set_cursor_position() will be called with false for the visibility) so here it is fine. When the popup gets destroyed the TextInput does not receive the FocusOut event and therefore the Cursor was not hidden. Maybe it can be implemented more generic that first the popup takes the focus so all objects loose the focus and then closing it? I tested your case: export component MainWindow inherits Window {
VerticalLayout {
padding: 20px;
alignment: space-between;
property <bool> hide: false;
Timer {
running: true;
interval: 10s;
triggered => {
parent.hide = true;
}
}
if !hide: LineEdit {
edited(text) => {
}
}
Rectangle {}
}
}We have the problem here as well. Also the keyboard does not disappear. The FocusOut Event was not triggered Bildschirmaufzeichnung.vom.2026-03-17.09-28-49.mp4 |
|
I see. I wonder what is the cleanest way to fix this issue. |
You think about unfocusing all elements? I will try to write a few tests so we catch all cases and don't destroy anything else |
|
In |
I would prefer that the items FocusOut is called so if there is anything else to cleanup can be done there as well? |
Disable text input focus and cursor state when a popup is closed to ensure a clean UI state. This prevents lingering cursor visibility and input focus issues after popup dismissal.
Fixes #11004