Skip to content

Add ARIA hints and fix spurious announcements in Find/Filter widgets #292375

@accesswatch

Description

@accesswatch

Summary

This issue tracks ARIA improvements and bug fixes for find/filter widgets to enhance the screen reader experience.

Problem Statement

Currently, find widgets have several accessibility issues:

  1. Spurious "No results" announcements - The find widget announces "No results" even when the search string is empty, causing confusing screen reader output
  2. Stale aria-label updates - The widget updates aria-labels even when not visible, which can interfere with screen reader focus
  3. Missing accessibility help hints - Users have no indication that accessibility help is available (Alt+F1)
  4. Double-speak issue - Hints can be announced multiple times in rapid succession

Proposed Changes

Bug Fixes (findWidget.ts)

  1. Guard search result announcements - Only announce results when a search string is present:

    // Before: Always announced results
    // After: Only announce when search string exists
    if (this._state.searchString) {
        this._updateSearchResultAria();
    }
  2. Check widget visibility - Only update aria-label when widget is visible:

    if (!this._isVisible) {
        return;
    }

ARIA Hint Additions (simpleFindWidget.ts)

Add accessibility help hints to all find widgets inheriting from SimpleFindWidget:

  1. Add announcement tracking flag:

    private _accessibilityHelpHintAnnounced: boolean = false;
  2. Add IConfigurationService and IAccessibilityService for settings checks

  3. Announce hint pattern - Announce "Press Alt+F1 for accessibility help" on focus:

    • Only announce once per session
    • Uses 1-second reset timeout to prevent double-speak
    • Only when accessibility.verbosity.find setting is enabled
    • Only when screen reader is active

Files Changed

File Change Type Description
src/vs/editor/contrib/find/browser/findWidget.ts Bug Fix Guard against spurious announcements
src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts Enhancement Add ARIA hints base implementation
src/vs/workbench/browser/parts/views/viewFilter.ts Enhancement Add ARIA hints to tree filter widgets
src/vs/workbench/contrib/search/browser/searchWidget.ts Enhancement Add ARIA hints to search widget
src/vs/workbench/contrib/terminalContrib/find/browser/terminalFindWidget.ts Wiring Add service dependencies
src/vs/workbench/contrib/webview/browser/webviewFindWidget.ts Wiring Add service dependencies

Acceptance Criteria

  • No "No results" announcement when search input is empty
  • No aria-label updates when find widget is hidden
  • Screen reader users hear "Press Alt+F1 for accessibility help" once when focusing find input
  • Hint only announces when accessibility.verbosity.find setting is enabled
  • No double-speak of the hint

Related

Testing

  1. Enable screen reader (NVDA/JAWS/VoiceOver)
  2. Open find widget (Ctrl+F)
  3. Verify hint is announced once
  4. Close and reopen - verify hint announces again
  5. Clear search input - verify no "No results" announcement

Metadata

Metadata

Assignees

Labels

accessibilityKeyboard, mouse, ARIA, vision, screen readers (non-specific) issuesfeature-requestRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code Insidersverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions