Skip to content

fix(youtube-player): a11y keyboard-accessible#798

Merged
harlan-zw merged 2 commits into
mainfrom
worktree-agent-a27f76b2357a5c059
May 27, 2026
Merged

fix(youtube-player): a11y keyboard-accessible#798
harlan-zw merged 2 commits into
mainfrom
worktree-agent-a27f76b2357a5c059

Conversation

@harlan-zw
Copy link
Copy Markdown
Collaborator

@harlan-zw harlan-zw commented May 27, 2026

🔗 Linked issue

Resolves #797

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

ScriptYouTubePlayer's placeholder responds to mouse triggers but was not reachable by keyboard, so AT users could not load the video. While the placeholder is showing and the configured trigger is event-based (e.g. mousedown), the root element now gets tabindex="0", role="button" and aria-label="Play video". An onPlaceholderKeydown handler dispatches the configured trigger event on the root for Enter/Space so the load path matches a click. Non-event triggers (immediate, onNuxtReady, visibility, visible) keep previous behaviour.

Adds tabindex, role=button, aria-label and Enter/Space key handling on
the ScriptYouTubePlayer placeholder so keyboard users can load the
video without a pointer. The keydown handler dispatches the configured
trigger event on the root element so it flows through the existing
useScriptTriggerElement listener.

Closes #797
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
scripts-playground Ready Ready Preview, Comment May 27, 2026 6:44am

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 27, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts@798

commit: d752b44

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

ScriptYouTubePlayer.vue adds keyboard accessibility to the player placeholder. A new computed keyboardTriggerable flag identifies when the player has not yet been triggered via certain trigger types (immediate, onNuxtReady, visibility, visible). A new onPlaceholderKeydown handler dispatches configured trigger events when the placeholder receives Enter or Space key presses. The root element's ARIA attributes now dynamically switch from non-interactive application role to button role with tabindex: 0 when keyboard activation is enabled. The template root element conditionally attaches the keydown listener only when keyboard triggering is applicable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The pull request successfully addresses issue #797 by implementing keyboard navigation (Tab focus and Enter/Space activation) for the ScriptYouTubePlayer placeholder through ARIA attributes and keydown event handling.
Out of Scope Changes check ✅ Passed All changes are directly related to adding keyboard accessibility to the YouTube player placeholder as specified in issue #797; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly explains the changes: adding keyboard accessibility to ScriptYouTubePlayer's placeholder with tabindex, role, and aria-label attributes, plus a keydown handler for Enter/Space keys that dispatches the configured trigger event, while preserving behavior for non-event triggers.
Title check ✅ Passed The title 'fix(youtube-player): a11y keyboard-accessible' directly addresses the main change: adding keyboard accessibility to the YouTube player placeholder, which is the core objective and the primary modification in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-agent-a27f76b2357a5c059

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@harlan-zw harlan-zw changed the title fix(youtube-player): make placeholder keyboard-accessible fix(youtube-player): a11y keyboard-accessible May 27, 2026
@harlan-zw harlan-zw merged commit 8b4e999 into main May 27, 2026
19 checks passed
@harlan-zw harlan-zw deleted the worktree-agent-a27f76b2357a5c059 branch May 27, 2026 07:20
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.

ScriptYouTubePlayer is not accessible via keyboard navigation (Tab/Enter keys)

1 participant