chore(input): forward keydown event to TextInput, PasswordInput

This commit is contained in:
Eric Liu 2020-07-30 16:37:26 -07:00
commit ea12dbe503
3 changed files with 17 additions and 2 deletions

View file

@ -166,6 +166,7 @@
on:input={({ target }) => { on:input={({ target }) => {
value = target.value; value = target.value;
}} }}
on:keydown
on:focus on:focus
on:blur /> on:blur />
<button <button

View file

@ -22,9 +22,19 @@
<TextInputSkeleton hideLabel /> <TextInputSkeleton hideLabel />
</div> </div>
{:else if story === 'password-visibility'} {:else if story === 'password-visibility'}
<PasswordInput {...$$props} aria-level="" /> <PasswordInput
{...$$props}
aria-level=""
on:keydown={(e) => {
console.log('on:keydown', e);
}} />
{:else if story === 'controlled'} {:else if story === 'controlled'}
<PasswordInput {...$$props} {type} /> <PasswordInput
{...$$props}
{type}
on:keydown={(e) => {
console.log('on:keydown', e);
}} />
<div> <div>
<button <button
on:click={() => { on:click={() => {
@ -44,6 +54,9 @@
bind:ref bind:ref
{...$$props} {...$$props}
bind:value bind:value
on:keydown={(e) => {
console.log('on:keydown', e);
}}
on:change={() => { on:change={() => {
console.log('change'); console.log('change');
}} /> }} />

View file

@ -138,6 +138,7 @@
on:input={({ target }) => { on:input={({ target }) => {
value = target.value; value = target.value;
}} }}
on:keydown
on:focus on:focus
on:blur /> on:blur />
</div> </div>