Skip to content

Conversation

@anthonykim1
Copy link
Contributor

@anthonykim1 anthonykim1 commented Dec 9, 2025

Resolves: #278855

TODO: Get recommendation on keyboard shortcut if we want them :)
TODO: Make sure files to register this announcement command are in proper location

@anthonykim1 anthonykim1 added this to the December / January 2026 milestone Dec 9, 2025
@anthonykim1 anthonykim1 self-assigned this Dec 9, 2025
Copilot AI review requested due to automatic review settings December 9, 2025 06:59
export const showAccessibilityHelpAction = nls.localize("showAccessibilityHelpAction", "Show Accessibility Help");
export const listSignalSounds = nls.localize("listSignalSoundsCommand", "Run the command: List Signal Sounds for an overview of all sounds and their current status.");
export const listAlerts = nls.localize("listAnnouncementsCommand", "Run the command: List Signal Announcements for an overview of announcements and their current status.");
export const announceCursorPosition = nls.localize("announceCursorPosition", "Run the command: Announce Cursor Position{0} to hear the current line and column.", '<keybinding:editor.action.announceCursorPosition>');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@meganrogge Should we also add keybinding to this command?
I'm not sure if we want something along the line with ctrl+g which was the old "hacky" way of folks accessing this info.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if alt/option+shift+g would be good ? @jooyoungseo and @rperez030 might know. We can ask on Friday!


registerAction2(ToggleScreenReaderMode);

class AnnounceCursorPosition extends Action2 {
Copy link
Contributor Author

@anthonykim1 anthonykim1 Dec 9, 2025

Choose a reason for hiding this comment

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

@meganrogge Do you think this would be the best/most appropriate place to register this command?
Other places I've been debating are:

  1. src\vs\workbench\contrib\accessibilitySignals\browser\commands.ts
  2. src\vs\workbench\contrib\accessibility\browser\accessibleViewActions.ts

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks fine to me!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new command editor.action.announceCursorPosition that announces the current cursor position (line and column) to screen reader users. This addresses an accessibility need where users want to quickly hear their current cursor location without navigating to the status bar.

Key Changes:

  • New AnnounceCursorPosition action that uses the ARIA alert() function to announce position
  • Integration with accessibility help documentation to inform users about the new command
  • Localized strings for the command title, description, and announcement message

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.ts Implements the new AnnounceCursorPosition command that retrieves the cursor position and announces it via screen reader
src/vs/workbench/contrib/accessibility/browser/editorAccessibilityHelp.ts Adds reference to the new command in the accessibility help content
src/vs/editor/common/standaloneStrings.ts Adds localized string for the accessibility help entry with keybinding placeholder


async run(accessor: ServicesAccessor): Promise<void> {
const codeEditorService = accessor.get(ICodeEditorService);
const editor = codeEditorService.getFocusedCodeEditor();
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

Consider also falling back to getActiveCodeEditor() if getFocusedCodeEditor() returns null. Many similar commands in the codebase use the pattern: codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor() to ensure the command works even when the editor doesn't have focus. Examples can be found in toggleColumnSelection.ts lines 81-85 and accessibleViewActions.ts line 328.

Suggested change
const editor = codeEditorService.getFocusedCodeEditor();
const editor = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@meganrogge meganrogge left a comment

Choose a reason for hiding this comment

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

Didn't test (we should) but LGTM! We should test using status and alert and see how each behaves.

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.

Add command to announce the current editor line number via aria.status

3 participants