on xenial help sign in
Hide keyboard when Launcher or Drawer are dragged
329a385Dalton Durst
qml/Launcher/Drawer.qml+9
@@ -115,6 +115,10 @@ FocusScope {
115 searchField.focus = true;
115 searchField.focus = true;
116 }
116 }
117
117
118+ function unFocusInput() {
119+ searchField.focus = false;
120+ }
121+
118 Keys.onPressed: {
122 Keys.onPressed: {
119 if (event.text.trim() !== "") {
123 if (event.text.trim() !== "") {
120 focusInput();
124 focusInput();
@@ -279,6 +283,11 @@ FocusScope {
279 delegateWidth: root.delegateWidth
283 delegateWidth: root.delegateWidth
280 delegateHeight: units.gu(11)
284 delegateHeight: units.gu(11)
281 delegate: drawerDelegateComponent
285 delegate: drawerDelegateComponent
286+ onDraggingVerticallyChanged: {
287+ if (draggingVertically) {
288+ unFocusInput();
289+ }
290+ }
282 }
291 }
283 }
292 }
284
293
qml/Launcher/DrawerGridView.qml+1
@@ -26,6 +26,7 @@ FocusScope {
26 property alias model: gridView.model
26 property alias model: gridView.model
27 property alias interactive: gridView.interactive
27 property alias interactive: gridView.interactive
28 property alias currentIndex: gridView.currentIndex
28 property alias currentIndex: gridView.currentIndex
29+ property alias draggingVertically: gridView.draggingVertically
29
30
30 property alias header: gridView.header
31 property alias header: gridView.header
31 property alias topMargin: gridView.topMargin
32 property alias topMargin: gridView.topMargin
qml/Launcher/Launcher.qml+4
@@ -439,6 +439,10 @@ FocusScope {
439 root.focus = false;
439 root.focus = false;
440 }
440 }
441
441
442+ onDraggingChanged: {
443+ drawer.unFocusInput()
444+ }
445+
442 Behavior on x {
446 Behavior on x {
443 enabled: !dragArea.dragging && !launcherDragArea.drag.active && panel.animate;
447 enabled: !dragArea.dragging && !launcherDragArea.drag.active && panel.animate;
444 NumberAnimation {
448 NumberAnimation {
tests/qmltests/Launcher/tst_Drawer.qml+33
@@ -388,5 +388,38 @@ StyledItem {
388 tryCompare(launcher, "state", "");
388 tryCompare(launcher, "state", "");
389 tryCompare(drawer, "draggingHorizontally", false);
389 tryCompare(drawer, "draggingHorizontally", false);
390 }
390 }
391+
392+ function test_draggingAppListHidesKeyboard() {
393+ // Ensures that dragging on the list of apps unfocuses the search
394+ // field, hiding the keyboard
395+ // Fix for https://github.com/ubports/ubuntu-touch/issues/1238
396+ var drawer = dragDrawerIntoView();
397+ var appList = findChild(drawer, "drawerAppList");
398+ var searchField = drawer.searchTextField;
399+
400+ searchField.focus = true;
401+
402+ var startX = drawer.width / 2;
403+ var startY = drawer.height / 2;
404+ touchFlick(drawer, startX, startY, startX, startY+units.gu(1))
405+
406+ tryCompare(searchField, "focus", false);
407+ }
408+
409+ function test_draggingLauncherHidesKeyboard() {
410+ // Ensures that dragging on the Launcher unfocuses the search
411+ // field, hiding the keyboard
412+ // Fix for https://github.com/ubports/ubuntu-touch/issues/1245
413+ var drawer = dragDrawerIntoView();
414+ var searchField = drawer.searchTextField;
415+
416+ searchField.focus = true;
417+
418+ var startX = launcher.width / 2;
419+ var startY = launcher.height / 2;
420+ touchFlick(drawer, startX, startY, startX, startY+units.gu(1))
421+
422+ tryCompare(searchField, "focus", false);
423+ }
391 }
424 }
392}
425}