Skip to content

Commit e73f641

Browse files
authored
Remove deprecated a11y-no-onchange warning (#6457)
1 parent fca6a6d commit e73f641

File tree

5 files changed

+1
-88
lines changed

5 files changed

+1
-88
lines changed

site/content/docs/05-accessibility-warnings.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,6 @@ Enforce that heading elements (`h1`, `h2`, etc.) and anchors have content and th
191191

192192
---
193193

194-
### `a11y-no-onchange`
195-
196-
Enforce usage of `on:blur` over/in parallel with `on:change` on select menu elements for accessibility. `on:blur` should be used instead of `on:change`, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users. `on:blur` is a more declarative action by the user: for instance in a dropdown, using the arrow keys to toggle between options will trigger the `on:change` event in some browsers. Regardless, when a change of context results from an `on:blur` event or an `on:change` event, the user should be notified of the change unless it occurs below the currently focused element.
197-
198-
```sv
199-
<select on:change={e => {}} on:blur={e => {}}>
200-
<option>foo</option>
201-
<option>bar</option>
202-
</select>
203-
204-
<!-- A11y: on:blur must be used instead of on:change, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users. -->
205-
<select on:change={e => {}}>
206-
<option>foo</option>
207-
<option>bar</option>
208-
</select>
209-
```
210-
211-
---
212-
213194
### `a11y-positive-tabindex`
214195

215196
Avoid positive `tabIndex` property values to synchronize the flow of the page with keyboard tab order.

site/src/routes/tutorial/[slug]/_TableOfContents.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
{selected.chapter.title}
7878
</span>
7979

80-
<!-- svelte-ignore a11y-no-onchange -->
8180
<select value={slug} on:change={navigate}>
8281
{#each sections as section, i}
8382
<optgroup label="{i + 1}. {section.title}">

src/compiler/compile/nodes/Element.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ const a11y_required_content = new Set([
5757
'h6'
5858
]);
5959

60-
const a11y_no_onchange = new Set([
61-
'select',
62-
'option'
63-
]);
64-
6560
const a11y_labelable = new Set([
6661
'button',
6762
'input',
@@ -435,19 +430,14 @@ export default class Element extends Node {
435430

436431

437432
validate_special_cases() {
438-
const { component, attributes, handlers } = this;
433+
const { component, attributes } = this;
439434

440435
const attribute_map = new Map();
441-
const handlers_map = new Map();
442436

443437
attributes.forEach(attribute => (
444438
attribute_map.set(attribute.name, attribute)
445439
));
446440

447-
handlers.forEach(handler => (
448-
handlers_map.set(handler.name, handler)
449-
));
450-
451441
if (this.name === 'a') {
452442
const href_attribute = attribute_map.get('href') || attribute_map.get('xlink:href');
453443
const id_attribute = attribute_map.get('id');
@@ -543,15 +533,6 @@ export default class Element extends Node {
543533
}
544534
}
545535

546-
if (a11y_no_onchange.has(this.name)) {
547-
if (handlers_map.has('change') && !handlers_map.has('blur')) {
548-
component.warn(this, {
549-
code: 'a11y-no-onchange',
550-
message: 'A11y: on:blur must be used instead of on:change, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users.'
551-
});
552-
}
553-
}
554-
555536
if (a11y_distracting_elements.has(this.name)) {
556537
// no-distracting-elements
557538
component.warn(this, {

test/validator/samples/a11y-no-onchange/input.svelte

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/validator/samples/a11y-no-onchange/warnings.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)