Skip to content

Commit

Permalink
fix: on mobile, added a delay before showing the keyboard #345
Browse files Browse the repository at this point in the history
  • Loading branch information
scambier committed Aug 13, 2024
1 parent 1ccfe23 commit 34e7f37
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/InputSearch.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script lang="ts">
import { debounce } from 'obsidian'
import { debounce, Platform } from 'obsidian'
import { toggleInputComposition } from 'src/globals'
import { createEventDispatcher, tick } from 'svelte'
import type OmnisearchPlugin from '../main'
import { wait } from "../tools/utils";
export let initialValue = ''
export let placeholder = ''
Expand All @@ -28,11 +29,13 @@
function selectInput(_?: HTMLElement): void {
tick()
.then(() => {
.then(async () => {
if (Platform.isMobileApp) await wait(200)
elInput.focus()
return tick()
})
.then(() => {
.then(async () => {
if (Platform.isMobileApp) await wait(200)
elInput.select()
})
}
Expand All @@ -57,7 +60,7 @@
placeholder="{placeholder}"
spellcheck="false"
type="text"
use:selectInput />
use:selectInput/>
</div>
<slot />
<slot/>
</div>

0 comments on commit 34e7f37

Please sign in to comment.