File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed
site/src/routes/demo/chip-input Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 95
95
bind:this ={input }
96
96
bind:value ={text }
97
97
{...prefixFilter (restProps , ' input$' )}
98
- onkeydown ={(e ) => {
99
- handleInputKeydown (e );
100
- restProps .input$onkeydown ?.(e );
101
- }}
102
98
/>
103
99
</Textfield >
104
100
{#snippet loading ()}
118
114
119
115
<script lang =" ts" >
120
116
import type { ComponentProps , Snippet } from ' svelte' ;
117
+ import { onMount } from ' svelte' ;
118
+ import { on } from ' svelte/events' ;
121
119
import type { SmuiAttrs } from ' @smui/common' ;
122
120
import type { ActionArray } from ' @smui/common/internal' ;
123
121
import {
321
319
... (key != null ? { key } : {}),
322
320
});
323
321
322
+ onMount (() => {
323
+ const el = input ?.getElement ();
324
+
325
+ if (el ) {
326
+ return on (
327
+ el ,
328
+ ' keydown' ,
329
+ (e ) => {
330
+ handleInputKeydown (e );
331
+ restProps .input$onkeydown ?.(
332
+ e as KeyboardEvent & {
333
+ currentTarget: EventTarget & HTMLInputElement ;
334
+ },
335
+ );
336
+ },
337
+ { passive: false },
338
+ );
339
+ }
340
+ });
341
+
324
342
function handleAutocompleteSelected(event : CustomEvent <any >) {
325
343
event .preventDefault ();
326
344
Original file line number Diff line number Diff line change 20
20
<Demo component ={Objects } file =" chip-input/_Objects.svelte" >
21
21
Objects
22
22
{#snippet subtitle ()}
23
- Objects allow you to have dupliate entries.
23
+ Objects allow you to have duplicate entries.
24
24
{/ snippet }
25
25
</Demo >
26
26
Original file line number Diff line number Diff line change 143
143
case ' range' :
144
144
value = toNumber (e .currentTarget .value );
145
145
break ;
146
- // Fall through.
147
146
default :
148
147
value = e .currentTarget .value ;
149
148
break ;
You can’t perform that action at this time.
0 commit comments