Skip to content

site: a11y change select on:change to on:blur #6189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<h2>Insecurity questions</h2>

<form on:submit|preventDefault={handleSubmit}>
<select bind:value={selected} on:change="{() => answer = ''}">
<select bind:value={selected} on:blur="{() => answer = ''}">
{#each questions as question}
<option value={question}>
{question.text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<h2>Insecurity questions</h2>

<form on:submit|preventDefault={handleSubmit}>
<select value={selected} on:change="{() => answer = ''}">
<select value={selected} on:blur="{() => answer = ''}">
{#each questions as question}
<option value={question}>
{question.text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<h2>Insecurity questions</h2>

<form on:submit|preventDefault={handleSubmit}>
<select bind:value={selected} on:change="{() => answer = ''}">
<select bind:value={selected} on:blur="{() => answer = ''}">
{#each questions as question}
<option value={question}>
{question.text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Select bindings
We can also use `bind:value` with `<select>` elements. Update line 24:

```html
<select bind:value={selected} on:change="{() => answer = ''}">
<select bind:value={selected} on:blur="{() => answer = ''}">
```

Note that the `<option>` values are objects rather than strings. Svelte doesn't mind.
Expand Down
2 changes: 1 addition & 1 deletion test/runtime/samples/select-change-handler/main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
</script>

<select bind:value={selected} on:change="{() => updateLastChangedTo(selected)}">
<select bind:value={selected} on:blur="{() => updateLastChangedTo(selected)}">
{#each options as option}
<option value="{option.id}">{option.id}</option>
{/each}
Expand Down