Skip to content

Fix hover accessible view icons being read as "space" by screen readers #252347

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 24, 2025

Screen readers were announcing "space" instead of meaningful text when focusing on icons in the hover accessible view toolbar. This occurred because the actions were rendered as icon-only buttons without proper accessibility labels.

Root Cause

The issue stemmed from how the WorkbenchToolBar renders actions by default:

  1. Actions are rendered with { icon: true, label: false } creating icon-only buttons
  2. Elements get codicon CSS classes for visual icons (e.g., "codicon codicon-add")
  3. No text content is set, only CSS-rendered icons
  4. Screen readers rely on aria-label which is derived from the action's tooltip
  5. Without explicit tooltip setting, the aria-label could be missing or incorrect

Solution

In HoverAccessibleViewProvider._getActionFor(), explicitly set the action's tooltip to ensure meaningful aria-labels:

const actionInstance = new Action(accessibleActionId, actionLabel, ThemeIcon.asClassName(actionCodicon), actionEnabled, () => {
    editor.getAction(actionId)?.run({ index: this._focusedHoverPartIndex, focus: false });
});
actionInstance.tooltip = actionLabel; // ← This fix ensures proper aria-label
return actionInstance;

Technical Flow

  1. Action created with meaningful label ("Increase Hover Verbosity")
  2. Tooltip explicitly set to same text (the fix)
  3. WorkbenchToolBar renders as icon-only button
  4. ActionViewItem.updateAriaLabel() uses tooltip for aria-label
  5. Screen readers now announce the meaningful text instead of "space"

Testing

Added comprehensive test coverage to verify actions have proper tooltips for accessibility.

The fix is minimal (3 lines) and maintains all existing functionality while ensuring screen readers properly announce "Increase Hover Verbosity" and "Decrease Hover Verbosity" for the respective toolbar icons.

Fixes #217974.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • electronjs.org
    • Triggering command: node-gyp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits June 24, 2025 21:21
Co-authored-by: aiday-mar <61460952+aiday-mar@users.noreply.github.com>
Co-authored-by: aiday-mar <61460952+aiday-mar@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Hover accessible view shows icons as space Fix hover accessible view icons being read as "space" by screen readers Jun 24, 2025
Copilot finished work on behalf of aiday-mar June 24, 2025 21:26
@Copilot Copilot AI requested a review from aiday-mar June 24, 2025 21:26
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.

Hover accessible view shows icons as space
2 participants