Skip to content

a11y: label injected controls and preserve native focus - #4334

Draft
imparable2022 wants to merge 3 commits into
code-charity:masterfrom
imparable2022:a11y/youtube-controls
Draft

imparable2022 wants to merge 3 commits into
code-charity:masterfrom
imparable2022:a11y/youtube-controls

Conversation

@imparable2022

@imparable2022 imparable2022 commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Stacked PR

Depends on #4333 (and therefore #4332). This PR is a draft while the preceding accessibility layers are reviewed.

The new change to review here is commit 45e6b2fc5828c1807e1d1eaa1141872c54fe2149.

Problem

ImprovedTube injects icon-only/custom controls into YouTube that do not always expose stable accessible names. Separately, upstream code temporarily replaces HTMLElement.prototype.focus, which can interfere with keyboard and screen-reader focus at a global page level.

What changes

Page-world accessibility

  • add js&css/web-accessible/accessibility.js
  • derive stable names from ARIA/text/title/tooltip data and known ImprovedTube classes
  • hide decorative SVGs
  • add visible focus outlines to ImprovedTube controls
  • title ImprovedTube settings iframes
  • expose tooltip/title success/error feedback through a polite status region
  • observe dynamically inserted/updated controls

Wiring

  • add the module to manifest.json web-accessible resources
  • load it before page-world init.js

Preserve native focus

  • remove active ImprovedTube.forbidFocus(2100) usage
  • neutralize the legacy global HTMLElement.prototype.focus replacement in appearance.js
  • prevent shortcuts.js from assigning HTMLElement.prototype.focus as part of that workaround

The injected-control module is additive. The focus-safety part restores native browser focus semantics rather than introducing another focus model.

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.

1 participant