From dc07324b7a48eac95e2b290db1e475d63d4d4bbe Mon Sep 17 00:00:00 2001 From: lgmarchi Date: Tue, 10 Dec 2024 12:24:21 -0300 Subject: [PATCH] fix(Chatbar): adjust autoFocus behavior for Android and iOS devices, so keyboard will not be opened when user enter in the chat --- src/lib/layouts/Chatbar.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/layouts/Chatbar.svelte b/src/lib/layouts/Chatbar.svelte index af60187e6..e5dd7ac75 100644 --- a/src/lib/layouts/Chatbar.svelte +++ b/src/lib/layouts/Chatbar.svelte @@ -14,14 +14,13 @@ import { type Message as MessageType } from "$lib/types" import { ProfilePicture } from "$lib/components" import CombinedSelector from "$lib/components/messaging/CombinedSelector.svelte" - import { checkMobile, isiOSMobile } from "$lib/utils/Mobile" + import { checkMobile, isAndroidOriOS, isiOSMobile } from "$lib/utils/Mobile" import { UIStore } from "$lib/state/ui" import { emojiList, emojiRegexMap } from "$lib/components/messaging/emoji/EmojiList" import { tempCDN } from "$lib/utils/CommonVariables" import { MessageEvent } from "warp-wasm" import StoreResolver from "$lib/components/utils/StoreResolver.svelte" import MessageText from "$lib/components/messaging/message/MessageText.svelte" - import { ToastMessage } from "$lib/state/ui/toast" export let replyTo: MessageType | undefined = undefined export let emojiClickHook: (emoji: string) => boolean @@ -159,7 +158,7 @@ return result } - onMount(() => { + onMount(async () => { hackVariableToRefocusChatBar.set(Math.random().toString()) }) @@ -172,7 +171,7 @@ hook={`${activeChat.id}-${$hackVariableToRefocusChatBar}`} alt placeholder={$_("generic.placeholder")} - autoFocus={true} + autoFocus={isAndroidOriOS() ? false : true} bind:value={$message} rounded rich={markdown}