fix: add pointer and touch events to a11y_no_static_element_interactions warning (#17548)

* fix: add pointer and touch events to a11y_no_static_element_interactions warning

Fixes #17527

The a11y_no_static_element_interactions warning now triggers for pointer
and touch events (onpointerdown, onpointerenter, ontouchstart, etc.)
in addition to mouse and drag events.

This ensures accessibility warnings are consistent across all pointer
input methods.

* fix test

---------

Co-authored-by: Daniel <daniel@example.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/17537/head
Richman018 6 months ago committed by GitHub
parent 5e0d18d210
commit 5872b89fb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -67,7 +67,21 @@ export const a11y_interactive_handlers = [
'mousemove',
'mouseout',
'mouseover',
'mouseup'
'mouseup',
// Pointer events
'pointerdown',
'pointerup',
'pointermove',
'pointerenter',
'pointerleave',
'pointerover',
'pointerout',
'pointercancel',
// Touch events
'touchstart',
'touchend',
'touchmove',
'touchcancel'
];
export const a11y_recommended_interactive_handlers = [

@ -17,3 +17,6 @@
<div on:keydown={() => {}}></div>
<!-- svelte-ignore a11y_missing_attribute -->
<a on:mousedown={() => {}} on:mouseup={() => {}} on:copy={() => {}}>link</a>
<div on:pointerdown={() => {}}></div>
<div on:pointerenter={() => {}}></div>
<div on:touchstart={() => {}}></div>

@ -22,5 +22,41 @@
"column": 0,
"line": 19
}
},
{
"code": "a11y_no_static_element_interactions",
"end": {
"column": 37,
"line": 20
},
"message": "`<div>` with a pointerdown handler must have an ARIA role",
"start": {
"column": 0,
"line": 20
}
},
{
"code": "a11y_no_static_element_interactions",
"end": {
"column": 38,
"line": 21
},
"message": "`<div>` with a pointerenter handler must have an ARIA role",
"start": {
"column": 0,
"line": 21
}
},
{
"code": "a11y_no_static_element_interactions",
"end": {
"column": 36,
"line": 22
},
"message": "`<div>` with a touchstart handler must have an ARIA role",
"start": {
"column": 0,
"line": 22
}
}
]

Loading…
Cancel
Save