web/Omnibox: ignore keyboard shortcuts when processing

This commit is contained in:
wukko 2024-07-16 22:11:57 +06:00
parent d31090c3d5
commit 504dfdb995
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
2 changed files with 5 additions and 2 deletions

View file

@ -28,6 +28,8 @@
let linkInput: HTMLInputElement | undefined; let linkInput: HTMLInputElement | undefined;
let isFocused = false; let isFocused = false;
let isDisabled: boolean = false;
let downloadButton: SvelteComponent; let downloadButton: SvelteComponent;
const validLink = (link: string) => { const validLink = (link: string) => {
@ -67,7 +69,7 @@
}; };
const handleKeydown = (e: KeyboardEvent) => { const handleKeydown = (e: KeyboardEvent) => {
if (!linkInput || $dialogs.length > 0) { if (!linkInput || $dialogs.length > 0 || isDisabled) {
return; return;
} }
@ -136,7 +138,7 @@
<ClearButton click={() => (link = "")} /> <ClearButton click={() => (link = "")} />
{/if} {/if}
{#if validLink(link)} {#if validLink(link)}
<DownloadButton url={link} bind:this={downloadButton} /> <DownloadButton url={link} bind:this={downloadButton} bind:isDisabled={isDisabled} />
{/if} {/if}
</div> </div>

View file

@ -10,6 +10,7 @@
import type { DialogInfo } from "$lib/types/dialog"; import type { DialogInfo } from "$lib/types/dialog";
export let url: string; export let url: string;
export let isDisabled = false;
$: buttonText = ">>"; $: buttonText = ">>";
$: buttonAltText = $t('a11y.save.download'); $: buttonAltText = $t('a11y.save.download');