Skip to content

Fix keyboard navigation consistency in TUI Update dialog#549

Merged
SorraTheOrc merged 2 commits intomainfrom
copilot/fix-navigation-in-update-window
Mar 11, 2026
Merged

Fix keyboard navigation consistency in TUI Update dialog#549
SorraTheOrc merged 2 commits intomainfrom
copilot/fix-navigation-in-update-window

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

The Update Work Item dialog had an inconsistent tab order that didn't match its visual layout, and Escape key handlers were missing on the Status and Priority lists, making keyboard navigation unreliable.

Changes

src/tui/controller.ts

  • Tab order: Fixed updateDialogFieldOrder to follow visual left-to-right column order (Status → Stage → Priority → Comment); was previously Stage → Status → Priority → Comment
  • Initial focus: openUpdateDialog() now focuses statusOptions (leftmost) instead of stageOptions
  • Escape handlers: Added explicit KEY_ESCAPE handlers on updateDialogStatusOptions and updateDialogPriorityOptions — only the stage list alias (updateDialogOptions) and comment textarea had them previously, leaving two lists unable to reliably close the dialog on Escape

tests/tui/tui-update-dialog.test.ts

  • Added tests for correct visual tab order and focus wrapping at boundaries
  • Added Escape key behavior tests: verifies all three selection lists have handlers and that each closes the dialog

src/tui/components/update-dialog-README.md (new)

  • Documents the tab order, per-control keyboard semantics (Arrow/Tab/Shift-Tab/Enter/Escape), and layout for the Update dialog

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

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

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh issue create --repo owner/name --title Item without GitHub mapping --body-file - g/tmp-worktree-0/home/REDACTED/work/ContextHub/ContextHub/tests/cli/mock-bin/git ules/.bin/bash bash i/mo�� init g/tmp-worktree-yQILHj/wt 0/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/bash worktree g/tmp-worktree-0/home/REDACTED/work/ContextHub/ContextHub/tests/cli/mock-bin/git odules/npm/node_rev-parse bash (http block)
    • Triggering command: /usr/bin/gh gh issue create --repo owner/name --title Item 1 --body-file - --is-inside-work/home/REDACTED/work/ContextHub/ContextHub/tests/cli/mock-bin/git i/mock-bin/git bash i/mo�� -C /tmp/worklog-test-x872u0/.workloworklog/data e_modules/.bin/bash --orphan worklog/data ode-gyp-bin/bashrev-parse bash (http block)
    • Triggering command: /usr/bin/gh gh issue create --repo owner/name --title Item 2 --body-file - --is-inside-work/home/REDACTED/work/ContextHub/ContextHub/tests/cli/mock-bin/git i/mock-bin/bash /bin/sh i/mo�� git -C '/tmp/worklog-test-x872u0--orphan bash odules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/bash rev-parse O9IRS/wt /usr/local/sbin/rev-parse bash (http block)

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

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix navigation in update window</issue_title>
<issue_description>

Problem statement

Navigation inside the TUI "Update" window is inconsistent for keyboard and mouse users: focus order, selection-list keyboard behaviour, and focus restoration when navigating between items are unclear or broken. This causes friction, accessibility regressions for screen-reader users, and risks accidental data loss when controls unexpectedly steal or lose focus.

Users

  • Editors (power users) who use the TUI to update items via keyboard and mouse.
  • Screen-reader users who rely on predictable focus and dialog announcements.
  • Mobile/touch users who interact with inline lists and fields in constrained viewports.

Example user stories

  • As a keyboard-only editor, I want Tab and Shift+Tab to move predictably between the three item-setting lists and other controls so I can make changes without losing context.
  • As a screen-reader user, I want the Update dialog announced on open and each control to expose role/state so I can navigate and confirm changes.
  • As a mobile user, I want touch interactions with lists and fields to behave consistently and not hide focused fields behind the keyboard.

Success criteria

  • Focus and tab order: Tab/Shift+Tab moves in a logical, documented order across header controls → primary editor → the three item-setting lists → metadata fields → Save/Cancel; no controls are skipped.
  • Selection-list behaviour: For the three inline item-setting lists (project/type/assignee or as-implemented), lists are treated as already-open interactive areas — Tab moves between lists (not to open them); Arrow keys navigate list options; Enter selects; Escape cancels; behaviour consistent across all three lists and documented in component README.
  • Accessibility: Opening the Update window announces dialog title/role; lists and controls expose roles/states; screen-reader walkthrough of the primary flows succeeds.
  • Safety: Navigating Next/Previous item preserves unsaved changes (confirmation shown) and focus lands in the primary editor of the new item.
  • Tests: Unit/integration tests cover keyboard handlers and focus management; at least one end-to-end Playwright/Cypress test automates open → edit → list selection → save flows on desktop and mobile viewports.

Constraints

  • Respect existing TUI patterns (mouse-guard, overlay-dismiss) implemented in related work; do not redesign dialog modality unless necessary.
  • Keep changes minimal and backwards-compatible with existing keyboard shortcuts unless an explicit improvement is approved.
  • Avoid introducing heavy runtime dependencies; prefer incremental tests that run in CI.

Existing state

  • src/tui/controller.ts registers updateOverlay click handlers and contains dialog open/close logic; tests mock updateOverlay in multiple places.
  • Mouse-guard and overlay click-to-dismiss behaviours have been implemented (see WL-0MLRFF0771A8NAVW and child tasks), including unit tests and a PR; keyboard/tab-order and selection-list ARIA/roving-tabindex patterns are not fully specified or tested.

Desired change

  • Audit the Update window to define a clear tab order and per-control keyboard semantics.
  • Implement keyboard handlers for the three inline selection lists so Arrow keys, Enter, Escape and Tab behave consistently with the chosen pattern (Tab moves between lists; lists are treated as interactive areas that are already open).
  • Add ARIA roles/attributes and ensure dialog is announced on open.
  • Add unit and integration tests for keyboard handlers and focus cycles; add a Playwright/Cypress e2e test covering desktop and mobile viewport flows.
  • Document the final tab order and list interaction rules in the component README.

Related work

  • TUI: prevent mouse click-through from dialogs to underlying widgets (WL-0MLRFF0771A8NAVW) — implemented mouse guard and overlay-dismiss; reduces overlap but does not fully address keyboard/tab behaviour.
  • Overlay click-to-dismiss (WL-0MLYZQS741EZPASH) — added updateOverlay click handler and tests.
  • Discard-changes confirmation dialog (WL-0MLYZR6NH182R4ZR) — implements Yes/No confirmation when overlay clicked with unsaved changes.
  • Guard screen mouse handler (WL-0MLYZQI9C1YGIUCW) and mouse-guard tests (WL-0MLYZQ52Q0NH7VOD) — relevant for click handling and tests.

Notes / open questions

  • Confirm the canonical names and exact identities of the three item-setting lists (e.g., Project, Type, Assignee) to reference them precisely in tests and docs. If names differ, tests should refer to the component IDs/selectors used in src/tui/components.
  • Confirm whether Escape should always return focus to the list trigger (recommended) or follow a different repo pattern.</issue_description>

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

@SorraTheOrc

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…pe handlers, add tests and docs

Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix navigation issues in update window Fix keyboard navigation consistency in TUI Update dialog Mar 10, 2026
@SorraTheOrc SorraTheOrc marked this pull request as ready for review March 11, 2026 01:17
@SorraTheOrc SorraTheOrc merged commit 46ac662 into main Mar 11, 2026
3 of 4 checks passed
@SorraTheOrc SorraTheOrc deleted the copilot/fix-navigation-in-update-window branch March 11, 2026 22:18
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.

Work items pane: contextual empty-state message

2 participants