Use event bubbling intead of hacky workaround

I'm not going to describe what the hacky workaround was, but you
can see for yourself if you're so interested.
This commit is contained in:
Badri Sunderarajan 2022-09-17 22:15:58 +05:30
parent e7bed614c9
commit ca92f79d7a
2 changed files with 4 additions and 6 deletions

View file

@ -4,16 +4,14 @@
export let hidden = false
export let autofocus = false
export let value = null
export let onfocus = () => {}
export let onblur = () => {}
</script>
<div class="input-container">
<label class="input-container__label">{label}</label>
{#if hidden}
<input type="password" tabindex="{tabindex}" class="input-container__input focusable" bind:value={value} {autofocus} on:focus={onfocus} on:blur={onblur}/>
<input type="password" tabindex="{tabindex}" class="input-container__input focusable" bind:value={value} {autofocus} on:focus on:blur/>
{:else}
<input type="text" tabindex="{tabindex}" class="input-container__input focusable" bind:value={value} {autofocus} on:focus={onfocus} on:blur={onblur}/>
<input type="text" tabindex="{tabindex}" class="input-container__input focusable" bind:value={value} {autofocus} on:focus on:blur/>
{/if}
</div>

View file

@ -135,8 +135,8 @@
tabindex={chatbox?.messages?.length || 0}
autofocus={true}
label='Compose'
onfocus={onComposeBoxFocus}
onblur={() => { centerSoftkeyLabel = 'Compose' }}
on:focus={onComposeBoxFocus}
on:blur={() => { centerSoftkeyLabel = 'Compose' }}
/>
</div>