Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

When the document editor opens, keyboard focus was not visible until users pressed Tab three times, violating WCAG 2.4.3 Focus Order.

Changes

  • Focus Management: Call editor.focus() immediately after Monaco editor mounts in handleMonacoEditorMount
const handleMonacoEditorMount = (
    editor: monacoEditor.editor.IStandaloneCodeEditor,
    _monaco: typeof monacoEditor,
) => {
    editorRef.current = editor;
    handleResize();
    
    // Set focus immediately so keyboard users see cursor on open
    editor.focus();
    
    // ...
};

This ensures the cursor is visible immediately when the view opens, allowing keyboard and screen reader users to begin editing without additional navigation.

Original prompt

This section details on the original issue you should resolve

<issue_title>Keyboard focus not visible Immediately after opening "Edit Selected Document": A11y_DocumentDB for VS Code Extension_focusOrder</issue_title>
<issue_description>### GitHub Tags
#A11yTCS; #A11yMAS; #A11ySev2; #DesktopApp; #FTP; #Win32; #DocumentDB for VS Code Extension; #SH_DocumentDB_Win32_NOV2025; #WCAG2.4.3; #FocusOrder;

Environment Details:

Application Name: DocumentDB for VS Code Extension
Version 0.6.0
OS: Windows 11[Version 23H2(OS Build 22631.3593)]

Repro Steps:

  1. Open VS code
  2. Install the DocumentDB for VS Code Extension and open it
  3. Navigate to the DocumentDB Connections area.
  4. Click the New Connection action.
  5. Select Connection String as the connection method.
  6. Paste the connection string when prompted.
  7. Choose to authenticate with username/password and enter the credentials
  8. Confirm to create the connection.
  9. Locate the desired cluster in the DocumentDB Connections list.
  10. Expand the cluster entry to initiate the connection.
  11. Expand one of the databases under the cluster.
  12. Expand a collection within that database.
  13. Select the Documents item for that collection.
  14. Collection View will open
  15. Observe that Keyboard focus not visible Immediately after opening "Edit Selected Document

Actual Result:

Keyboard focus not visible Immediately after opening "Edit Selected Document

Expected Result:
When the modal opens, focus should immediately move to the first interactive element or text field. This ensures users can begin interacting with the modal without needing to press Tab multiple times.

User Impact:

Users relying on keyboard navigation may not know where the focus is immediately after opening the "Edit Selected Document" modal, as the focus becomes visible only after pressing Tab three times. This creates confusion and disrupts the logical flow of interaction for users with visual or motor disabilities.

Attachment

https://github.com/user-attachments/assets/66c7b7cb-866e-4bc4-9ae8-8b108959897e</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

Added editor.focus() call in handleMonacoEditorMount to ensure keyboard focus
is immediately visible when the document view opens. This addresses WCAG 2.4.3
Focus Order accessibility requirement.

Co-authored-by: tnaum-ms <[email protected]>
Copilot AI changed the title [WIP] Fix keyboard focus visibility in DocumentDB extension Fix keyboard focus visibility when opening document editor Jan 14, 2026
Copilot AI requested a review from tnaum-ms January 14, 2026 17:07
@tnaum-ms tnaum-ms marked this pull request as ready for review January 14, 2026 19:17
@tnaum-ms tnaum-ms requested a review from a team as a code owner January 14, 2026 19:17
Copilot AI review requested due to automatic review settings January 14, 2026 19:17
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 fixes an accessibility issue where keyboard focus was not visible when the document editor opened, requiring users to press Tab three times before seeing focus. The fix adds a single line to call editor.focus() immediately after the Monaco editor mounts.

Changes:

  • Added editor.focus() call in handleMonacoEditorMount to set focus immediately after editor initialization
  • Added accessibility-focused comments explaining the WCAG 2.4.3 Focus Order requirement

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.

Keyboard focus not visible Immediately after opening "Edit Selected Document": A11y_DocumentDB for VS Code Extension_focusOrder

2 participants