Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix accessible names for embed youtube link #165

Merged
merged 4 commits into from
Nov 3, 2024
Merged

Conversation

anotheri
Copy link
Contributor

@anotheri anotheri commented Nov 2, 2024

ARIA commands must have an accessible name, read more: https://dequeuniversity.com/rules/axe/4.10/aria-command-name

Otherwise i'm getting this issue in lighthouse Accessibility report:

image

Copy link

netlify bot commented Nov 2, 2024

Deploy Preview for astro-embed ready!

Name Link
🔨 Latest commit aa4b03f
🔍 Latest deploy log https://app.netlify.com/sites/astro-embed/deploys/6727e324392edd0008669a41
😎 Deploy Preview https://deploy-preview-165--astro-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 48 to 49
<a {href} class="lty-playbtn" role="link" aria-label={title}>
<span class="lyt-visually-hidden">{attrs.playlabel}</span>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

This looks like it’s actually a bug in the use of attrs.playLabel as a child of the link. As documented in the <YouTube> component docs, this should have a default value of "Play", but it looks like we’re not providing that default, which we should do here:

Suggested change
<a {href} class="lty-playbtn" role="link" aria-label={title}>
<span class="lyt-visually-hidden">{attrs.playlabel}</span>
<a {href} class="lty-playbtn">
<span class="lyt-visually-hidden">{attrs.playlabel || 'Play'}</span>

In general, actually text content is preferable to aria-label as it is more widely accessible. There is also no need to apply a role="link" to an <a> element as this is already the default role.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, you're right if i provide playlabel that accessiblity issue gone, so i'll add default value now as you suggested.

Copy link

changeset-bot bot commented Nov 3, 2024

🦋 Changeset detected

Latest commit: d1d0c43

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astro-community/astro-embed-youtube Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Owner

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect — thanks @anotheri! I added a test and changeset and will get this released now.

@delucis delucis merged commit a97b51b into delucis:main Nov 3, 2024
5 checks passed
@github-actions github-actions bot mentioned this pull request Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants