Adds a11y progress

This commit is contained in:
Ollie Taylor
2023-02-22 00:36:40 +00:00
parent 95bb3263ff
commit bf1a9c1584
2 changed files with 28 additions and 0 deletions
@@ -0,0 +1,26 @@
<script lang="ts">
export let currentTime: number;
export let paused: boolean;
export let duration: number;
</script>
<progress
class="svelte-podcast-a11y-hidden"
data-paused={paused ? 'true' : 'false'}
max={duration}
value={currentTime}
/>
<style>
.svelte-podcast-a11y-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
</style>
+2
View File
@@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
import { usePlayer, type PlayerElement } from './audio'; import { usePlayer, type PlayerElement } from './audio';
import AudioA11yProgress from '$lib/components/audio-a11y-progress.svelte';
// TODO: Abstract to a store so we can add actions like reqind 20s // TODO: Abstract to a store so we can add actions like reqind 20s
@@ -67,5 +68,6 @@
on:emptied={(e) => console.log('emptied', e)} on:emptied={(e) => console.log('emptied', e)}
on:load={(e) => console.log('load', e)} on:load={(e) => console.log('load', e)}
/> />
<AudioA11yProgress {currentTime} {paused} {duration} />
<slot {duration} /> <slot {duration} />
{/key} {/key}