Skip to content

Commit

Permalink
Fix accessible names for embed youtube link (#165)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Swithinbank <[email protected]>
  • Loading branch information
anotheri and delucis authored Nov 3, 2024
1 parent f976d8d commit a97b51b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sixty-oranges-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astro-community/astro-embed-youtube": patch
---

Fixes missing accessible name for `<YouTube>` component play button
2 changes: 1 addition & 1 deletion packages/astro-embed-youtube/YouTube.astro
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const href = `https://youtube.com/watch?v=${videoid}`;
style={`background-image: url('${posterURL}');`}
>
<a {href} class="lty-playbtn">
<span class="lyt-visually-hidden">{attrs.playlabel}</span>
<span class="lyt-visually-hidden">{attrs.playlabel || 'Play'}</span>
</a>
</lite-youtube>

Expand Down
1 change: 1 addition & 0 deletions tests/astro-embed-youtube.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test('it should render a lite-youtube element', async () => {
);
assert.ok(playButton);
assert.is(playButton.href, `https://youtube.com/watch?v=${videoid}`);
assert.is(playButton.textContent?.trim(), 'Play');
});

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

0 comments on commit a97b51b

Please sign in to comment.