fix: media nav buttons should be a list (#1648)
More work on #1633, improves accessibility of the media nav buttons by cleaning up the list and labels a bit.
This commit is contained in:
parent
d03d223fd9
commit
4221ce1c72
|
@ -36,7 +36,11 @@
|
|||
/>
|
||||
{/if}
|
||||
{#if dots.length > 1}
|
||||
<div class="media-controls">
|
||||
<!-- Roughly based on https://www.w3.org/WAI/tutorials/carousels/functionality/
|
||||
Since this toolbar contains a mix of left/right/first/second/third/fourth buttons,
|
||||
just list them and explicitly label the current one as "current." -->
|
||||
<ul class="media-controls" aria-label="Navigate media items">
|
||||
<li class="media-control">
|
||||
<IconButton
|
||||
className="media-control-button"
|
||||
svgClassName="media-control-button-svg"
|
||||
|
@ -45,20 +49,23 @@
|
|||
href="#fa-angle-left"
|
||||
on:click="prev()"
|
||||
/>
|
||||
</li>
|
||||
{#each dots as dot, i (dot.i)}
|
||||
<!-- TODO: this should probably be aria-current or something, not a toggle button -->
|
||||
<li class="media-control">
|
||||
<IconButton
|
||||
className="media-control-button"
|
||||
svgClassName="media-control-button-svg"
|
||||
pressable={true}
|
||||
label="Show {nth(i)} media"
|
||||
pressedLabel="Showing {nth(i)} media"
|
||||
pressedLabel="Show {nth(i)} media (current)"
|
||||
pressed={i === scrolledItem}
|
||||
href={i === scrolledItem ? '#fa-circle' : '#fa-circle-o'}
|
||||
sameColorWhenPressed={true}
|
||||
on:click="onButtonClick(i)"
|
||||
/>
|
||||
</li>
|
||||
{/each}
|
||||
<li class="media-control">
|
||||
<IconButton
|
||||
className="media-control-button"
|
||||
svgClassName="media-control-button-svg"
|
||||
|
@ -67,7 +74,8 @@
|
|||
href="#fa-angle-right"
|
||||
on:click="next()"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
{#if canPinchZoom}
|
||||
<IconButton
|
||||
|
@ -144,6 +152,16 @@
|
|||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
ul.media-controls {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
li.media-control {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
:global(.media-pinch-zoom) {
|
||||
width: 100%;
|
||||
|
|
Loading…
Reference in a new issue