Add Navigate Back and Navigate Forward commands#4531
Draft
raineorshine with Copilot wants to merge 4 commits into
Draft
Add Navigate Back and Navigate Forward commands#4531raineorshine with Copilot wants to merge 4 commits into
raineorshine with Copilot wants to merge 4 commits into
Conversation
- Add navigateBack (⌘+[ / ⌘+←) and navigateForward (⌘+] / ⌘+→) commands using the Navigation API (window.navigation.back/forward, canGoBack/canGoForward) - Declare window.navigation in the global Window type - Remove categorize's conflicting ⌘+] alias (keeps primary ⌘+Alt+O) - Reuse ArrowLeft/ArrowRight icons; align their typing with icon convention - Add unit tests for canExecute/exec Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
Contributor
|
|
useCommandList requires every command to be in a COMMAND_GROUPS group or have hideFromHelp: true. Add both to the Navigation group. Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
…back-forward-commands Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
The categorize puppeteer test triggered categorize via ⌘+], which is now reassigned to Navigate Forward. Switch it to categorize's retained primary shortcut ⌘+Alt+O. Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
Copilot
AI
changed the title
feat(commands): add Navigate Back and Navigate Forward commands
Add Navigate Back and Navigate Forward commands
Jul 6, 2026
Copilot created this pull request from a session on behalf of
raineorshine
July 6, 2026 17:22
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two commands that drive the browser Navigation API from within em: Navigate Back (
⌘ + [/⌘ + ←) and Navigate Forward (⌘ + ]/⌘ + →), gated on whether history exists in that direction.Commands
navigateBack/navigateForwardcommands.execcallswindow.navigation.back()/forward();canExecutereflectswindow.navigation.canGoBack/canGoForward, so each is disabled (greyed out in the Command Universe) with no history to navigate to or when the API is unavailable.Wiring
src/commands/index.tsbarrel and the Navigation group inCOMMAND_GROUPS(constants.ts) — the latter is a runtime invariant (useCommandListthrows otherwise).ArrowLeftIcon/ArrowRightIcon; relaxed theirFC<IconType>typing to the plain(props: IconType) =>form used by all other command icons so they're assignable toCommand.svg.Types
window.navigation(canGoBack,canGoForward,back,forward) on the globalWindowinterface, as the Navigation API is not yet in the TS DOM lib. Optional, reflecting unsupported browsers (e.g. older Safari).Shortcut conflict
⌘ + ]was a secondary alias oncategorize; removed it (primary⌘ + Alt + Oretained) and updated the categorize puppeteer test to use the primary shortcut.Reviewer note
⌘ + ←/⌘ + →aliasespreventDefaultthe native caret-to-line-start/end while editing. If undesirable, the arrow aliases can be dropped while keeping the bracket bindings.