From 03b3cd7ab7aa40bb50ac88b93408ecbed99dd857 Mon Sep 17 00:00:00 2001 From: Daniel Kantor Date: Thu, 14 Apr 2022 12:26:21 +0200 Subject: [PATCH] fix: make virtual keyboard work better on touchscreen devices (#2147) --- apps/lluis/HorizontalScroller.svelte | 82 +++++++++++++++++++ .../integration/common/virtual_keyboard.js | 14 +++- apps/web/src/client.js | 4 + .../VirtualKeyboard.svelte | 55 ++++++++++--- 4 files changed, 140 insertions(+), 15 deletions(-) create mode 100644 apps/lluis/HorizontalScroller.svelte diff --git a/apps/lluis/HorizontalScroller.svelte b/apps/lluis/HorizontalScroller.svelte new file mode 100644 index 000000000000..820efba14bcf --- /dev/null +++ b/apps/lluis/HorizontalScroller.svelte @@ -0,0 +1,82 @@ + + +
+
+ +
+ + {#if scrollPosition > 0} +
+ {/if} + + {#if needsScroll && scrollPosition < scrollWidth} +
+ {/if} +
+ + diff --git a/apps/web/cypress/integration/common/virtual_keyboard.js b/apps/web/cypress/integration/common/virtual_keyboard.js index 9a57a1f8895f..07e2cb1781ab 100644 --- a/apps/web/cypress/integration/common/virtual_keyboard.js +++ b/apps/web/cypress/integration/common/virtual_keyboard.js @@ -1,18 +1,24 @@ import { Then } from "cypress-cucumber-preprocessor/steps" Then("I see a virtual keyboard with {int} keys", (n) => { - cy.get(".virtual-keyboard").find(">*").should("have.length", n) + cy.get(".virtual-keyboard .keys").find(">*").should("have.length", n) }) Then("the keys on the virtual keyboard have proper labels", () => { - cy.get(".virtual-keyboard").find(">*").contains("á").should("be.visible") + cy.get(".virtual-keyboard .keys") + .find(">*") + .contains("á") + .should("be.visible") }) Then("clicking on a key types into the input field", () => { - cy.get(".virtual-keyboard").find(">*").contains("á").click() + cy.get(".virtual-keyboard .keys").find(">*").contains("á").click() cy.get("input").should("have.value", "á") }) Then("the virtual keyboard is inactive", () => { - cy.get(".virtual-keyboard").find(">*").contains("á").should("be.disabled") + cy.get(".virtual-keyboard .keys") + .find(">*") + .contains("á") + .should("be.disabled") }) diff --git a/apps/web/src/client.js b/apps/web/src/client.js index 620cffcf121c..4f2b66eec0f5 100644 --- a/apps/web/src/client.js +++ b/apps/web/src/client.js @@ -12,6 +12,8 @@ import { faEnvelope, faHeart, faSpinner, + faCircleArrowRight, + faCircleArrowLeft, } from "@fortawesome/free-solid-svg-icons" import { faTwitter } from "@fortawesome/free-brands-svg-icons" @@ -25,6 +27,8 @@ library.add(faLock) library.add(faEnvelope) library.add(faHeart) library.add(faSpinner) +library.add(faCircleArrowRight) +library.add(faCircleArrowLeft) dom.watch() window.startMsw = () => { diff --git a/apps/web/src/components/InputFieldWithVirtualKeyboard/VirtualKeyboard.svelte b/apps/web/src/components/InputFieldWithVirtualKeyboard/VirtualKeyboard.svelte index ab2ba234ff26..e538afd98ba0 100644 --- a/apps/web/src/components/InputFieldWithVirtualKeyboard/VirtualKeyboard.svelte +++ b/apps/web/src/components/InputFieldWithVirtualKeyboard/VirtualKeyboard.svelte @@ -1,5 +1,7 @@
- {#each characters as character} - - {/each} + + +
+ {#each characters as character} + + {/each} +
+
+