Focus doesn't go away when clicking outside TextInput
Author: ilmaiCreated Sep 30, 2023Updated Sep 30, 2026
Labelsa:language-c++a:language-rustapi
I'm working on a DAW plugin with slint and in that context, it's absolutely essential that input focus is only kept while actually entering text. Otherwise for example pressing the spacebar won't toggle play/pause in the DAW when a plugin window is open.
Currently if you click on a TextInput, it will keep its input focus forever even if you click outside it. For reference, most of the regular (non-plugin) software I tested loses input focus when clicking outside a textbox, so this seems to be expected behavior even outside plugin context.
I'm currently using a workaround like this, that covers the entire root element, but it feels like a hack:
TouchArea {
FocusScope {
enabled: true;
}
}Source: slint-ui/slint