@@ -113,6 +113,7 @@ Item {
113113
114114 visible: searchEntryEnabled
115115 property bool popoverShouldOpen: false
116+ property bool popoverShouldClose: false
116117
117118 property bool narrowMode: parent.width < label.contentWidth + units.gu(50)
118119
@@ -131,8 +132,10 @@ Item {
131132 onStateChanged: {
132133 if (state == "active" || state == "narrowActive") {
133134 popoverShouldOpen = true;
135+ popoverShouldClose = false;
134136 } else {
135137 popoverShouldOpen = false;
138+ popoverShouldClose = true;
136139 }
137140 }
138141
@@ -146,7 +149,8 @@ Item {
146149 }
147150 )
148151 }
149− popoverShouldOpen = true;
152+ popoverShouldOpen = false;
153+ popoverShouldClose = false;
150154 }
151155
152156 function closePopover() {
@@ -155,6 +159,7 @@ Item {
155159 searchContainer.popover = null;
156160 }
157161 popoverShouldOpen = false;
162+ popoverShouldClose = false;
158163 }
159164
160165 onActiveFocusChanged: if (!activeFocus) { searchHistory.addQuery(searchField.text) }
@@ -302,7 +307,7 @@ Item {
302307 },
303308 Transition {
304309 to: "inactive"
305− ScriptAction { script: if (!searchContainer.popoverShouldOpen) { searchContainer.closePopover(); } }
310+ ScriptAction { script: if (searchContainer.popoverShouldClose) { searchContainer.closePopover(); } }
306311 NumberAnimation { targets: [searchContainer, searchField] ; property: "width"; duration: 200; easing.type: Easing.InOutQuad }
307312 AnchorAnimation { targets: [searchContainer, textContainer]; duration: 200; easing.type: Easing.InOutQuad }
308313 },
@@ -318,7 +323,7 @@ Item {
318323 },
319324 Transition {
320325 to: "narrowInactive"
321− ScriptAction { script: if (!searchContainer.popoverShouldOpen) { searchContainer.closePopover(); } }
326+ ScriptAction { script: if (searchContainer.popoverShouldClose) { searchContainer.closePopover(); } }
322327 NumberAnimation { targets: [searchContainer, searchField] ; property: "width"; duration: 200; easing.type: Easing.OutQuad }
323328 AnchorAnimation { targets: [searchContainer, textContainer]; duration: 200; easing.type: Easing.InOutQuad }
324329 }