Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions documentation/examples/04-events/00-dom-events/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
}
</script>

<!-- svelte-ignore a11y-no-static-element-interactions -->
<div on:mousemove={handleMousemove}>
The mouse position is {m.x} x {m.y}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
let m = { x: 0, y: 0 };
</script>

<!-- svelte-ignore a11y-no-static-element-interactions -->
<div on:mousemove={(e) => (m = { x: e.clientX, y: e.clientY })}>
The mouse position is {m.x} x {m.y}
</div>
Expand Down
1 change: 1 addition & 0 deletions documentation/examples/08-motion/01-spring/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
</label>
</div>

<!-- svelte-ignore a11y-no-static-element-interactions -->
<svg
on:mousemove={(e) => coords.set({ x: e.clientX, y: e.clientY })}
on:mousedown={() => size.set(30)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
{#if selected}
{#await selected then d}
<div class="photo" in:receive={{ key: d.id }} out:send={{ key: d.id }}>
<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-noninteractive-element-interactions -->
<img alt={d.alt} src="{ASSETS}/{d.id}.jpg" on:click={() => (selected = null)} />

<p class="credit">
Expand Down
8 changes: 4 additions & 4 deletions documentation/examples/11-easing/00-easing/Controls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
{:else}
<ul>
{#each [...eases] as [name]}
<li class:selected={name === current_ease} on:click={() => (current_ease = name)}>
{name}
<li class:selected={name === current_ease}>
<button on:click={() => (current_ease = name)}> {name}</button>
</li>
{/each}
</ul>
Expand All @@ -46,8 +46,8 @@
{:else}
<ul>
{#each types as [name, type]}
<li class:selected={type === current_type} on:click={() => (current_type = type)}>
{name}
<li class:selected={type === current_type}>
<button on:click={() => (current_type = type)}> {name}</button>
</li>
{/each}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
</script>

<!-- svelte-ignore a11y-no-static-element-interactions -->
<div on:mouseenter={enter} on:mouseleave={leave}>
<slot {hovering} />
</div>
3 changes: 2 additions & 1 deletion documentation/examples/15-composition/05-modal/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
$: if (dialog && showModal) dialog.showModal();
</script>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-noninteractive-element-interactions -->
<dialog
bind:this={dialog}
on:close={() => (showModal = false)}
on:click|self={() => dialog.close()}
>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div on:click|stopPropagation>
<slot name="header" />
<hr />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
</script>

<span class:expanded on:click={toggle}>{name}</span>
<button class:expanded on:click={toggle}>{name}</button>

{#if expanded}
<ul transition:slide={{ duration: 300 }}>
Expand All @@ -28,12 +28,14 @@
{/if}

<style>
span {
button {
padding: 0 0 0 1.5em;
background: url(/tutorial/icons/folder.svg) 0 0.1em no-repeat;
background-size: 1em 1em;
font-weight: bold;
cursor: pointer;
border:none;
font-size:14px;
}

.expanded {
Expand Down
3 changes: 2 additions & 1 deletion documentation/examples/20-7guis/06-7guis-circles/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ radius of the selected circle.
<button on:click={() => travel(-1)} disabled={i === 0}>undo</button>
<button on:click={() => travel(+1)} disabled={i === undoStack.length - 1}>redo</button>
</div>

<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
<svg on:click={handleClick}>
{#each circles as circle}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<circle
cx={circle.cx}
cy={circle.cy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

<h2>Immutable</h2>
{#each todos as todo}
<ImmutableTodo {todo} on:click={() => toggle(todo.id)} />
<ImmutableTodo {todo} on:click={() => toggle(todo.id)} /><br>
{/each}

<h2>Mutable</h2>
{#each todos as todo}
<MutableTodo {todo} on:click={() => toggle(todo.id)} />
<MutableTodo {todo} on:click={() => toggle(todo.id)} /><br>
{/each}
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@

export let todo;

let div;
let btn;

afterUpdate(() => {
flash(div);
flash(btn);
});
</script>

<!-- the text will flash red whenever
the `todo` object changes -->
<div bind:this={div} on:click>
<button bind:this={btn} on:click>
{todo.done ? '👍' : ''}
{todo.text}
</div>
</button>

<style>
div {
button {
cursor: pointer;
line-height: 1.5;
border:none;
background:none;
font-size:14px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@

export let todo;

let div;
let btn;

afterUpdate(() => {
flash(div);
flash(btn);
});
</script>

<!-- the text will flash red whenever
the `todo` object changes -->
<div bind:this={div} on:click>
<button bind:this={btn}>
{todo.done ? '👍' : ''}
{todo.text}
</div>
</button>

<style>
div {
button {
cursor: pointer;
line-height: 1.5;
border:none;
background:none;
font-size:14px;
}
</style>