Skip to content

Commit a97b51b

Browse files
anotheridelucis
andauthored
Fix accessible names for embed youtube link (#165)
Co-authored-by: Chris Swithinbank <[email protected]>
1 parent f976d8d commit a97b51b

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.changeset/sixty-oranges-sneeze.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@astro-community/astro-embed-youtube": patch
3+
---
4+
5+
Fixes missing accessible name for `<YouTube>` component play button

packages/astro-embed-youtube/YouTube.astro

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const href = `https://youtube.com/watch?v=${videoid}`;
4646
style={`background-image: url('${posterURL}');`}
4747
>
4848
<a {href} class="lty-playbtn">
49-
<span class="lyt-visually-hidden">{attrs.playlabel}</span>
49+
<span class="lyt-visually-hidden">{attrs.playlabel || 'Play'}</span>
5050
</a>
5151
</lite-youtube>
5252

tests/astro-embed-youtube.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test('it should render a lite-youtube element', async () => {
2121
);
2222
assert.ok(playButton);
2323
assert.is(playButton.href, `https://youtube.com/watch?v=${videoid}`);
24+
assert.is(playButton.textContent?.trim(), 'Play');
2425
});
2526

2627
test('it parses a youtube.com URL', async () => {

0 commit comments

Comments
 (0)