From e9c828a2c534d255c0220d8c957d50106087c482 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 22 Jan 2025 18:19:25 +0100 Subject: [PATCH] Android: back button will close the keyboard --- src/UI/AllThemesGui.svelte | 10 +++++++++- src/UI/Base/Searchbar.svelte | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/UI/AllThemesGui.svelte b/src/UI/AllThemesGui.svelte index 1a61fcac0e..a81105abbc 100644 --- a/src/UI/AllThemesGui.svelte +++ b/src/UI/AllThemesGui.svelte @@ -10,7 +10,7 @@ import LoginToggle from "./Base/LoginToggle.svelte" import Pencil from "../assets/svg/Pencil.svelte" import Constants from "../Models/Constants" - import { Store, Stores, UIEventSource } from "../Logic/UIEventSource" + import { ImmutableStore, Store, Stores, UIEventSource } from "../Logic/UIEventSource" import ThemesList from "./BigComponents/ThemesList.svelte" import { MinimalThemeInformation } from "../Models/ThemeConfig/ThemeConfig" import Eye from "../assets/svg/Eye.svelte" @@ -105,6 +105,14 @@ } }) + AndroidPolyfill.onBackButton((() => { + if(searchIsFocussed.data){ + searchIsFocussed.set(false) + return true + } + return false + }), {returnToIndex: new ImmutableStore(false)}) + /** * Opens the first search candidate */ diff --git a/src/UI/Base/Searchbar.svelte b/src/UI/Base/Searchbar.svelte index 8c7c431d4a..ad04a1a849 100644 --- a/src/UI/Base/Searchbar.svelte +++ b/src/UI/Base/Searchbar.svelte @@ -31,6 +31,8 @@ inputElement?.select() } }) + }else if(document.activeElement === inputElement){ + inputElement?.blur() } })