Skip to content

feat: add keyboard page navigation - #71

Merged
ericjypark merged 2 commits into
ericjypark:mainfrom
bbnotcode:codex/keyboard-split
Aug 18, 2026
Merged

ericjypark merged 2 commits into
ericjypark:mainfrom
bbnotcode:codex/keyboard-split

Conversation

@bbnotcode

@bbnotcode bbnotcode commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What

Adds Command-click cycling and Command-1/2/3 direct page selection for the island page indicator.

The existing one-shot footer hint remains unchanged, keeping persistent chrome quiet. Caps Lock is ignored when matching Command shortcuts so enabled Caps Lock does not break navigation.

Validation

  • Full Swift test suite
  • Swift frontend parsing
  • Localization plist validation
  • Diff whitespace checks

Split from #67 following maintainer feedback.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added keyboard shortcuts (⌘1, ⌘2, ⌘3) for switching between screens
    • Added left and right arrow key navigation
  • UI/UX Improvements

    • Updated page indicator controls with improved interaction and accessibility support
    • Added localized shortcut descriptions
  • Localization

    • Added English and Simplified Chinese translations for screen-switching shortcuts

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e16cd6b7-7bc3-44d7-bb62-b2ebeb9cbc2a

📥 Commits

Reviewing files that changed from the base of the PR and between 376b4ad and 30cc396.

📒 Files selected for processing (3)
  • Resources/en.lproj/Localizable.strings
  • Resources/zh-Hans.lproj/Localizable.strings
  • Sources/Views/PageIndicator.swift

📝 Walkthrough

Walkthrough

The change replaces page indicator gestures with buttons, adds English and Simplified Chinese shortcut text, and centralizes keyboard handling for screen selection, arrow navigation, and Command-Q termination.

Changes

Navigation controls

Layer / File(s) Summary
Page indicator controls
Resources/*/Localizable.strings, Sources/Views/PageIndicator.swift
Page indicators now use buttons with preserved styling and accessibility behavior. The buttons include localized shortcut help text.
Keyboard navigation
Sources/Window/IslandWindowController.swift
Key events now route through handleKeyDown, which handles Command-number selection, arrow navigation, and Command-Q termination when the window and island state allow it.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LocalKeyMonitor
  participant IslandWindowController
  participant PageIndicator
  LocalKeyMonitor->>IslandWindowController: forward key event to handleKeyDown
  IslandWindowController->>PageIndicator: select or navigate screen
  IslandWindowController->>IslandWindowController: terminate on Command-Q
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding keyboard navigation for page selection.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 376b4adf5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +162 to +164
if modifiers == .command,
let character = event.charactersIgnoringModifiers,
let index = ["1", "2", "3"].firstIndex(of: character) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Match Command-number shortcuts across keyboard layouts

On keyboard layouts where number-row digits require Shift, such as French AZERTY, the key labeled 1 produces either & without Shift or 1 with .shift; the exact modifiers == .command check therefore rejects both ways of entering the advertised ⌘1 shortcut. Numeric-keypad events are similarly rejected because they include .numericPad. Match these shortcuts through layout-aware key-equivalent handling or otherwise account for the additional flags so direct page selection remains usable outside US-style layouts.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Sources/Window/IslandWindowController.swift (1)

139-145: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep the key monitor active while the island window is key.

Line 142 removes the only .keyDown monitor when the cursor leaves the island. Line 138 makes the window key, but the exit path does not resign it. The expanded island can remain key but cannot receive Command-number or arrow navigation.

Install one monitor for the controller or visible-window lifetime. Keep the Line 150 key-window guard to scope handled events.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Sources/Window/IslandWindowController.swift` around lines 139 - 145, Update
the key-monitor lifecycle around the controller’s .keyDown monitor setup so it
remains installed for the controller or visible-window lifetime instead of being
removed when the cursor leaves the island. Remove the exit-path cleanup that
clears cmdQMonitor, while preserving the existing key-window guard in the event
handler to scope Command-number and arrow navigation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@Sources/Window/IslandWindowController.swift`:
- Around line 139-145: Update the key-monitor lifecycle around the controller’s
.keyDown monitor setup so it remains installed for the controller or
visible-window lifetime instead of being removed when the cursor leaves the
island. Remove the exit-path cleanup that clears cmdQMonitor, while preserving
the existing key-window guard in the event handler to scope Command-number and
arrow navigation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5860f327-110d-43e4-b5c6-9721b9774125

📥 Commits

Reviewing files that changed from the base of the PR and between 3b78b69 and 376b4ad.

📒 Files selected for processing (4)
  • Resources/en.lproj/Localizable.strings
  • Resources/zh-Hans.lproj/Localizable.strings
  • Sources/Views/PageIndicator.swift
  • Sources/Window/IslandWindowController.swift

bbnotcode and others added 2 commits August 18, 2026 15:59
The keyboard-navigation change also grew the dots to 7–8pt inside 24pt
button slots, roughly doubling the indicator's footprint in the footer.
Restore the original geometry, spacing, and opacities; keep the Button
wrapper and the ⌘-shortcut tooltip.
@ericjypark
ericjypark force-pushed the codex/keyboard-split branch from 376b4ad to 30cc396 Compare August 18, 2026 21:01
@ericjypark

Copy link
Copy Markdown
Owner

Thanks — the keyboard handling here is exactly right: hover-scoped monitor, key-window guard, expanded-only gating, and it applies cleanly on top of v0.1.23. Merging.

Two things I did on the branch (rebased onto main + one commit on top): the page-indicator dots were growing from 5pt to 7–8pt inside 24pt button slots, which roughly doubled the indicator's footer footprint — I restored the original geometry/opacities but kept your Button wrapper and the ⌘-shortcut tooltip, which are nice. Also note the PR body mentions Command-click cycling; the diff ships arrow keys + ⌘1/2/3, which is what's landing.

@ericjypark
ericjypark merged commit 0931117 into ericjypark:main Aug 18, 2026
1 check passed
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.

2 participants