Comment 17 for bug 1545802

Revision history for this message
Olivier Tilloy (osomon) wrote :

I’m looking at the code in InputHandler.qml (https://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/src/Ubuntu/Components/1.3/InputHandler.qml#L289) and something looks suspicious to me: input.focus is set to false when the main control (in our case the TextField) looses active focus, but I don’t see anywhere where it is restored to true.
The following patch seems to fix the regression, although I’m not sure it’s entirely correct, someone familiar with that code should review it and comment:

=== modified file 'src/Ubuntu/Components/1.3/InputHandler.qml'
--- src/Ubuntu/Components/1.3/InputHandler.qml 2016-04-25 10:45:41 +0000
+++ src/Ubuntu/Components/1.3/InputHandler.qml 2016-05-06 07:55:22 +0000
@@ -291,11 +291,7 @@
     Connections {
         target: main
         ignoreUnknownSignals: true
- onActiveFocusChanged: {
- if (!main.activeFocus) {
- input.focus = false;
- }
- }
+ onActiveFocusChanged: input.focus = main.activeFocus
         onKeyNavigationFocusChanged: {
             if (main.keyNavigationFocus) {
                 input.forceActiveFocus();