Fix accessibility of options tutorial. (#8308)

Use button instead of non-interactive element (div).
(Removes a Svelte a11y warning.)
pull/8311/head
brunnerh 2 years ago committed by GitHub
parent a0cedf8d82
commit e3e912ab58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,22 +4,24 @@
export let todo;
let div;
let button;
afterUpdate(() => {
flash(div);
flash(button);
});
</script>
<!-- the text will flash red whenever
the `todo` object changes -->
<div bind:this={div} on:click>
<button bind:this={button} type="button" on:click>
{todo.done ? '👍': ''} {todo.text}
</div>
</button>
<style>
div {
button {
all: unset;
display: block;
cursor: pointer;
line-height: 1.5;
}
</style>
</style>

@ -6,22 +6,24 @@
export let todo;
let div;
let button;
afterUpdate(() => {
flash(div);
flash(button);
});
</script>
<!-- the text will flash red whenever
the `todo` object changes -->
<div bind:this={div} on:click>
<button bind:this={button} type="button" on:click>
{todo.done ? '👍': ''} {todo.text}
</div>
</button>
<style>
div {
button {
all: unset;
display: block;
cursor: pointer;
line-height: 1.5;
}
</style>
</style>

Loading…
Cancel
Save