Reputation: 113
In the latest Svelte version they have added new accessibility warnings.
the doubt I have is that I would like to automate it on build so I don't have to constantly write the onkeyDown
event as in the example
<div on:click="{() => {clickEvent1()}}" on:keyDown="{() => {clickEvent1()}}" />
<div on:click="{() => {clickEvent2()}}" on:keyDown="{() => {clickEvent2()}}" />
<div on:click="{() => {clickEvent3()}}" on:keyDown="{() => {clickEvent3()}}" />
Any rollup package or Svelte option that automates it?
Upvotes: 0
Views: 646
Reputation: 184524
You are doing it wrong.
You are not supposed to add click
events on div
or other non-interactive elements. Things that are clickable should be in a button
, which can be styled however you want (can even be made to only show the contents).
Upvotes: 1