Skip to content

Tab-switch shortcuts - #483

Open
ianu82 wants to merge 2 commits into
pr/reopen-closed-tabfrom
pr/tab-shortcuts
Open

Tab-switch shortcuts#483
ianu82 wants to merge 2 commits into
pr/reopen-closed-tabfrom
pr/tab-shortcuts

Conversation

@ianu82

@ianu82 ianu82 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

Chrome's tab-switching muscle memory, in the browser route:

  • ⌘1 – ⌘8 jump to the nth tab
  • ⌘9 jumps to the last tab, however many there are
  • Ctrl+Tab / Ctrl+Shift+Tab cycle forward and backward, wrapping at the ends

Single-tab windows make the shortcuts quiet no-ops, and they don't interfere with the existing ⌘T / ⌘W / ⌘F / ⌘⇧T bindings.

Stacked on pr/reopen-closed-tab.

For QA

  1. With 3+ tabs open: ⌘1 / ⌘2 / ⌘3 activate the matching tabs; ⌘9 jumps to the last one.
  2. Ctrl+Tab walks forward through the strip, Ctrl+Shift+Tab walks backward, and both wrap around the ends.
  3. With only one tab: nothing happens, nothing breaks.
  4. ⌘T (new), ⌘W (close), ⌘F (find), ⌘⇧T (reopen) all still behave as before.

@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: 1ef4c7d785

ℹ️ 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".

const key = e.key.toLowerCase();
// Tab navigation first (both shift variants): ⌘1-8 = nth tab,
// ⌘9 = last tab, Ctrl+Tab / Ctrl+Shift+Tab cycle (Chrome).
if (mod && !e.altKey && key === 'tab') {

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 Handle tab shortcuts in the focused WebContents

When the user is actually interacting with a loaded page, focus is in the native tab WebContentsView rather than this React window, so this renderer-only keydown handler will not see Ctrl+Tab and the adjacent number-key shortcuts; I checked src/main/browser and there is no before-input-event/equivalent forwarding for these accelerators. As a result the new tab-switching shortcuts only work while the chrome/start page has focus, missing the normal browsing case the shortcut is meant to cover.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed — each tab view now mirrors the accelerators via before-input-event, so ⌘1-9 and Ctrl(+Shift)+Tab work while a page has focus; renderer handler stays for chrome focus (bb62636).

ianu82 added 2 commits July 23, 2026 10:25
Chrome muscle memory: ⌘1-8 activates the nth tab, ⌘9 the last, and
Ctrl(+Shift)+Tab cycles with wraparound. Renderer-only (state.tabs +
activate); handled before the other mod-combos so ⌘1-9 never
collides with future shortcuts.
Codex on #483: the renderer keydown only sees ⌘1-9 / Ctrl+Tab when the
browser chrome has focus — interacting with a loaded page puts focus in
the native WebContentsView and the shortcuts went dead. Each tab view
now mirrors the same accelerators via before-input-event (⌘1-8 nth,
⌘9 last, Ctrl(+Shift)+Tab cycles), with a test driving the event
through a fake view.
@ianu82
ianu82 force-pushed the pr/reopen-closed-tab branch from 5c5919d to 4430c09 Compare July 23, 2026 17:44
@ianu82
ianu82 force-pushed the pr/tab-shortcuts branch from 1ef4c7d to bb62636 Compare July 23, 2026 17:44
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.

1 participant