fix(radio-tile): move keydown, tabindex to input element

This commit is contained in:
Eric Liu 2020-09-14 06:54:35 -07:00
commit 17d97d1dbf
2 changed files with 13 additions and 10 deletions

View file

@ -57,14 +57,21 @@
name="{name}"
value="{value}"
checked="{checked}"
tabindex="{tabindex}"
class:bx--tile-input="{true}"
on:change
on:change="{() => {
update(value);
}}"
on:keydown
on:keydown="{(e) => {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault();
update(value);
}
}}" />
<label
for="{id}"
tabindex="{tabindex}"
class:bx--tile="{true}"
class:bx--tile--selectable="{true}"
class:bx--tile--is-selected="{checked}"
@ -73,14 +80,7 @@
on:click
on:mouseover
on:mouseenter
on:mouseleave
on:keydown
on:keydown="{(e) => {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault();
update(value);
}
}}">
on:mouseleave>
<span class:bx--tile__checkmark="{true}">
<CheckmarkFilled16
aria-label="{iconDescription}"

View file

@ -52,7 +52,10 @@
{...$$props}
value="{value}"
id="{id}"
labelText="{labelText}">
labelText="{labelText}"
on:keydown="{() => {
console.log('keydown');
}}">
Selectable Tile
</RadioTile>
{/each}