Closed as not planned
Description
Describe the bug
I noticed that when I use spread properties, I am not warned if I set onclick to an element that is not appropriate.
Example:
<!-- Comp.svelte -->
<script>
let props = $props()
</script>
<!-- Warned as expected -->
<div onclick={props.onclick}>btn1</div>
<!-- Not warned -->
<div {...props}>btn2</div>
<!-- App.svelte -->
<script>
import Comp from "./Comp.svelte"
</script>
<Comp onclick={()=> console.log("click")}></Comp>
Expected Logs:
Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as <button type="button"> or <a> might be more appropriate
https://svelte.dev/e/a11y_click_events_have_key_events (a11y_click_events_have_key_events)
<div> with a click handler must have an ARIA role
https://svelte.dev/e/a11y_no_static_element_interactions (a11y_no_static_element_interactions)
Reproduction
https://svelte.dev/playground/f5718f8d68974d49a65489872a064640?version=5.19.9
Logs
N/A
System Info
System:
OS: macOS 15.3
CPU: (10) arm64 Apple M4
Memory: 829.08 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.7.0 - /opt/homebrew/bin/node
npm: 10.9.2 - /opt/homebrew/bin/npm
Browsers:
Chrome: 132.0.6834.162
Safari: 18.3
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels