Skip to content

Keep keyboard focus inside open modal dialogs #172

Description

@iamnbutler

Tabbing forward through an open modal dialog briefly moves keyboard focus out of the dialog and onto the app navigation behind it. The next Tab returns focus to the dialog's first control. A modal dialog should keep focus inside it.

Found while validating #170 / #171. The same sequence happens before and after that change, so it is pre-existing and was not changed there.

Reproduce

  1. Open Ace in a browser at 1440×900 with any project, and open Settings (Ctrl/Cmd+,).
  2. Press Tab repeatedly past the last control (Close).

Observed Tab sequence from Close onward (in/OUT = whether document.activeElement is inside [data-slot=dialog-content]):

  • 5194bf7: in:Close > OUT:SPAN > OUT:Dashboard⌘1Channels⌘2… > in:Providers
  • b11535a: in:Close > OUT:SPAN > OUT:Dashboard⌘1Channels⌘2… > in:General

The SPAN is the dialog's focus guard. The next stop is the app's left navigation (Dashboard/Channels/Issues/PRs). Only after that does focus wrap back to the dialog's first control.

Observed in headless Chrome with real Tab key events sent over the DevTools protocol, against a source host. The native WebKit app was not checked. Evidence: /tmp/ace-ui-refresh-20261006/settings-evidence/tabtest.ts on natembp.

Expected

Tab and Shift+Tab cycle only among the dialog's controls while a modal dialog is open. Content behind the dialog is never focusable. This applies to every consumer of the shared packages/ui dialog: Settings, Open Project and Rename.

Related

#44 covers controls that stay reachable while the desktop sidebar is collapsed. This issue is about modal focus containment, not collapsed layout state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions