Commit 3cb49fc1 authored by Nate Graham's avatar Nate Graham
Browse files

Fix searchfield focus on touch launch

We don't want to focus the search field by default when Discover is
launched with a touch, because then the virtual keyboard appears in the
user's face and covers up the content.

There is existing code to do this, but it's not quite working. We want
the magic condition to be toggling the `focus:` property, which is what
controls whether it has focus by default. We don't need to care about
this if the user takes an action to explicitly focus it; that's all
right.

(cherry picked from commit ff07b70a)
parent 95b8fd74
Pipeline #151856 passed with stage
in 1 minute and 3 seconds
......@@ -45,9 +45,8 @@ Kirigami.GlobalDrawer {
}
}
// Give the search field keyboard focus by default
function forceSearchFieldFocus() {
if (searchField.visible && wideScreen && !Kirigami.InputMethod.willShowOnActive) {
if (searchField.visible && wideScreen) {
searchField.forceActiveFocus();
}
}
......@@ -79,6 +78,10 @@ Kirigami.GlobalDrawer {
id: searchField
Layout.fillWidth: true
// Give the search field keyboard focus by default, unless it would
// make the virtual keyboard appear, because we don't want that
focus: !Kirigami.InputMethod.willShowOnActive
visible: window.leftPage && (window.leftPage.searchFor !== null || window.leftPage.hasOwnProperty("search"))
page: window.leftPage
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment