Skip to content

Commit bbcb5f5

Browse files
docs: handle warnings in examples page (#8836)
ignore some, fix others --------- Co-authored-by: Simon H <[email protected]>
1 parent 68e6336 commit bbcb5f5

File tree

12 files changed

+35
-22
lines changed

12 files changed

+35
-22
lines changed

documentation/examples/04-events/00-dom-events/App.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
}
88
</script>
99

10+
<!-- svelte-ignore a11y-no-static-element-interactions -->
1011
<div on:mousemove={handleMousemove}>
1112
The mouse position is {m.x} x {m.y}
1213
</div>

documentation/examples/04-events/01-inline-handlers/App.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
let m = { x: 0, y: 0 };
33
</script>
44

5+
<!-- svelte-ignore a11y-no-static-element-interactions -->
56
<div on:mousemove={(e) => (m = { x: e.clientX, y: e.clientY })}>
67
The mouse position is {m.x} x {m.y}
78
</div>

documentation/examples/08-motion/01-spring/App.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</label>
2525
</div>
2626

27+
<!-- svelte-ignore a11y-no-static-element-interactions -->
2728
<svg
2829
on:mousemove={(e) => coords.set({ x: e.clientX, y: e.clientY })}
2930
on:mousedown={() => size.set(30)}

documentation/examples/09-transitions/06-deferred-transitions/App.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
{#if selected}
5050
{#await selected then d}
5151
<div class="photo" in:receive={{ key: d.id }} out:send={{ key: d.id }}>
52+
<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-noninteractive-element-interactions -->
5253
<img alt={d.alt} src="{ASSETS}/{d.id}.jpg" on:click={() => (selected = null)} />
5354

5455
<p class="credit">

documentation/examples/11-easing/00-easing/Controls.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
{:else}
2929
<ul>
3030
{#each [...eases] as [name]}
31-
<li class:selected={name === current_ease} on:click={() => (current_ease = name)}>
32-
{name}
31+
<li class:selected={name === current_ease}>
32+
<button on:click={() => (current_ease = name)}> {name}</button>
3333
</li>
3434
{/each}
3535
</ul>
@@ -46,8 +46,8 @@
4646
{:else}
4747
<ul>
4848
{#each types as [name, type]}
49-
<li class:selected={type === current_type} on:click={() => (current_type = type)}>
50-
{name}
49+
<li class:selected={type === current_type}>
50+
<button on:click={() => (current_type = type)}> {name}</button>
5151
</li>
5252
{/each}
5353
</ul>

documentation/examples/15-composition/03-slot-props/Hoverable.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
}
1111
</script>
1212

13+
<!-- svelte-ignore a11y-no-static-element-interactions -->
1314
<div on:mouseenter={enter} on:mouseleave={leave}>
1415
<slot {hovering} />
1516
</div>

documentation/examples/15-composition/05-modal/Modal.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
$: if (dialog && showModal) dialog.showModal();
77
</script>
88

9-
<!-- svelte-ignore a11y-click-events-have-key-events -->
9+
<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-noninteractive-element-interactions -->
1010
<dialog
1111
bind:this={dialog}
1212
on:close={() => (showModal = false)}
1313
on:click|self={() => dialog.close()}
1414
>
15+
<!-- svelte-ignore a11y-no-static-element-interactions -->
1516
<div on:click|stopPropagation>
1617
<slot name="header" />
1718
<hr />

documentation/examples/17-special-elements/00-svelte-self/Folder.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
</script>
1313

14-
<span class:expanded on:click={toggle}>{name}</span>
14+
<button class:expanded on:click={toggle}>{name}</button>
1515

1616
{#if expanded}
1717
<ul transition:slide={{ duration: 300 }}>
@@ -28,12 +28,14 @@
2828
{/if}
2929

3030
<style>
31-
span {
31+
button {
3232
padding: 0 0 0 1.5em;
3333
background: url(/tutorial/icons/folder.svg) 0 0.1em no-repeat;
3434
background-size: 1em 1em;
3535
font-weight: bold;
3636
cursor: pointer;
37+
border:none;
38+
font-size:14px;
3739
}
3840
3941
.expanded {

documentation/examples/20-7guis/06-7guis-circles/App.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ radius of the selected circle.
6969
<button on:click={() => travel(-1)} disabled={i === 0}>undo</button>
7070
<button on:click={() => travel(+1)} disabled={i === undoStack.length - 1}>redo</button>
7171
</div>
72-
72+
<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
7373
<svg on:click={handleClick}>
7474
{#each circles as circle}
75+
<!-- svelte-ignore a11y-click-events-have-key-events -->
7576
<circle
7677
cx={circle.cx}
7778
cy={circle.cy}

documentation/examples/21-miscellaneous/02-immutable-data/App.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727

2828
<h2>Immutable</h2>
2929
{#each todos as todo}
30-
<ImmutableTodo {todo} on:click={() => toggle(todo.id)} />
30+
<ImmutableTodo {todo} on:click={() => toggle(todo.id)} /><br>
3131
{/each}
3232

3333
<h2>Mutable</h2>
3434
{#each todos as todo}
35-
<MutableTodo {todo} on:click={() => toggle(todo.id)} />
35+
<MutableTodo {todo} on:click={() => toggle(todo.id)} /><br>
3636
{/each}

documentation/examples/21-miscellaneous/02-immutable-data/ImmutableTodo.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,25 @@
66
77
export let todo;
88
9-
let div;
9+
let btn;
1010
1111
afterUpdate(() => {
12-
flash(div);
12+
flash(btn);
1313
});
1414
</script>
1515

1616
<!-- the text will flash red whenever
1717
the `todo` object changes -->
18-
<div bind:this={div} on:click>
18+
<button bind:this={btn} on:click>
1919
{todo.done ? '👍' : ''}
2020
{todo.text}
21-
</div>
21+
</button>
2222

2323
<style>
24-
div {
24+
button {
2525
cursor: pointer;
26-
line-height: 1.5;
26+
border:none;
27+
background:none;
28+
font-size:14px;
2729
}
2830
</style>

documentation/examples/21-miscellaneous/02-immutable-data/MutableTodo.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@
44
55
export let todo;
66
7-
let div;
7+
let btn;
88
99
afterUpdate(() => {
10-
flash(div);
10+
flash(btn);
1111
});
1212
</script>
1313

1414
<!-- the text will flash red whenever
1515
the `todo` object changes -->
16-
<div bind:this={div} on:click>
16+
<button bind:this={btn}>
1717
{todo.done ? '👍' : ''}
1818
{todo.text}
19-
</div>
19+
</button>
2020

2121
<style>
22-
div {
22+
button {
2323
cursor: pointer;
24-
line-height: 1.5;
24+
border:none;
25+
background:none;
26+
font-size:14px;
2527
}
2628
</style>

0 commit comments

Comments
 (0)