Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(shortcuts): G-prefix navigation, two-key recording and the ? shortcut sheet (MUL-10203) (#11599)
Jiayuan Zhangf66e0c5bec74
diff --git a/apps/docs/content/docs/shortcuts.fr.mdx b/apps/docs/content/docs/shortcuts.fr.mdxindex 2b4dacb1ce..8120b100f0 100644--- a/apps/docs/content/docs/shortcuts.fr.mdx+++ b/apps/docs/content/docs/shortcuts.fr.mdx@@ -1,6 +1,6 @@---title: Recherche, raccourcis et préférences-description: Rechercher et exécuter des commandes avec ⌘K, consulter et modifier les raccourcis clavier, chercher du texte dans une tâche et régler vos préférences personnelles comme le thème, la langue et le fuseau horaire.+description: Rechercher et exécuter des commandes avec ⌘K, piloter les tâches et les listes au clavier, consulter et modifier les raccourcis clavier, chercher du texte dans une tâche et régler vos préférences personnelles comme le thème, la langue et le fuseau horaire.---import { Callout } from "fumadocs-ui/components/callout";@@ -27,8 +27,11 @@ Choisir un résultat l'ouvre. Maintenez `⌘` (`Ctrl` sous Windows et Linux) en## Raccourcis clavier+Appuyez sur `?` n'importe où hors d'un champ de saisie pour voir tous les raccourcis. Les groupes de la page où vous êtes passent en premier, marqués **page actuelle** ; tapez dans le champ du haut pour filtrer par nom. Le lien en bas ouvre **Paramètres → Raccourcis**.+| Action | macOS | Windows / Linux | Remarques ||---|---|---|---|+| Afficher les raccourcis clavier | `?` | `?` | || Ouvrir la recherche | `⌘K` | `Ctrl+K` | || Créer une tâche | `C` | `C` | Ouvre votre mode de création préféré. Sur la page d'un projet, la nouvelle tâche est préremplie avec ce projet. || Afficher ou masquer la barre latérale gauche | `⌘B` | `Ctrl+B` | |@@ -47,9 +50,56 @@ Choisir un résultat l'ouvre. Maintenez `⌘` (`Ctrl` sous Windows et Linux) en| Revenir en arrière | `⌘[` | `Ctrl+[` | || Avancer | `⌘]` | `Ctrl+]` | |-Les raccourcis à une seule touche (`C`, `E`, `H`, `U`, `J`, `K`, `Z`) et Revenir en arrière / Avancer ne réagissent pas pendant que vous tapez dans un champ.+Les raccourcis à une seule touche et Revenir en arrière / Avancer ne réagissent pas pendant que vous tapez dans un champ.++### Aller à une page++Appuyez sur `G`, puis sur une deuxième touche dans la seconde et demie :++| Touches | Ouvre |+|---|---|+| `G` `I` | Boîte de réception |+| `G` `M` | Mes tâches |+| `G` `T` | Tâches |+| `G` `P` | Projets |+| `G` `C` | Discussions |+| `G` `A` | Agents |-Le groupe **Navigation** propose aussi d'aller à la boîte de réception, aux discussions, à Mes tâches, aux tâches, aux projets, aux automatisations, aux agents, aux squads, aux statistiques, aux runtimes, aux skills et aux paramètres. Aucune de ces actions n'a de touche par défaut : attribuez-en à celles que vous utilisez. Aller à la boîte de réception ouvre la page Boîte de réception ; la liste des notifications elle-même est une section du panneau Travail, juste sous les épingles. Aller à Mes tâches ouvre la page Mes tâches, qui n'est pas la vue **Mon travail** du panneau Travail.+Le groupe **Navigation** des paramètres propose aussi d'aller aux automatisations, aux squads, aux statistiques, aux runtimes, aux skills et aux paramètres, sans touche par défaut : attribuez-en à celles que vous utilisez. Aller à la boîte de réception ouvre la page Boîte de réception ; la liste des notifications elle-même est une section du panneau Travail, juste sous les épingles. Aller à Mes tâches ouvre la page Mes tâches, qui n'est pas la vue **Mon travail** du panneau Travail.++Tant que `G` attend sa deuxième touche, celle-ci appartient à la séquence : `G` puis `P` ouvre les projets au lieu de définir une priorité. Toute autre touche met fin à l'attente et garde son effet habituel.++### Agir sur une tâche++Ces touches agissent sur la tâche devant vous : la page de tâche ouverte, la tâche dans un aperçu latéral, les tâches sélectionnées dans une liste ou la ligne où se trouve le curseur de liste. Chacune ouvre le même sélecteur que la commande correspondante de la recherche, déjà sur cette tâche ou cette sélection.++| Action | Touche | Remarques |+|---|---|---|+| Changer le statut | `S` | |+| Assigner | `A` | |+| Définir la priorité | `P` | |+| Modifier les libellés | `L` | |+| Définir l'échéance | `⇧D` | `Shift+D` sous Windows et Linux. |+| Déplacer vers un projet | `⇧P` | `Shift+P` sous Windows et Linux. |+| Lancer une action rapide | `Q` | Sur une seule tâche, quand l'espace de travail a des actions rapides actives. |+| Répondre | `R` | Place le curseur dans la zone de commentaire de la tâche ouverte. |++Les invités ne peuvent utiliser que `R`.++### Parcourir les listes et les tableaux++Sur une liste, une table ou un tableau de tâches, les touches ci-dessous déplacent un curseur d'une tâche à l'autre. Elles ne se modifient pas. Pointer une ligne y déplace le curseur et le masque ; la touche suivante repart de cette ligne.++| Action | macOS | Windows / Linux | Remarques |+|---|---|---|---|+| Descendre / monter | `J` / `K`, ou `↓` / `↑` | `J` / `K`, ou `↓` / `↑` | La première pression part du haut, ou du bas en montant. |+| Changer de colonne du tableau | `←` / `→` | `←` / `→` | Sur un tableau uniquement. Dans l'aperçu latéral d'un tableau, `H` / `L` font de même. |+| Ouvrir | `↵` | `Enter` | Ouvre la tâche comme l'indique **Ouverture des tâches** dans les préférences. |+| Aperçu | `Space` | `Space` | Ouvre ou ferme l'aperçu latéral. |+| Sélectionner | `X` | `X` | Ajoute la tâche à la sélection, ou l'en retire. |+| Étendre la sélection | `⇧↓` / `⇧↑` | `Shift+↓` / `Shift+↑` | |+| Tout sélectionner | `⌘A` | `Ctrl+A` | Une fois le curseur affiché ou une sélection faite. |+| Effacer la sélection | `Échap` | `Échap` | Un second `Échap` masque le curseur. |### Raccourcis système fixes@@ -76,6 +126,8 @@ Ouvrez **Paramètres → Raccourcis**. Le champ de recherche en haut retrouve unCliquez sur les touches à droite d'une action. Quand « Appuyez sur les touches » s'affiche, tapez la nouvelle combinaison. `Échap` annule ; `Suppr` efface le raccourci de l'action.+Pour une action **Navigation**, vous pouvez aussi enregistrer deux touches à la suite, comme `G` puis `U`. Après une seule lettre, la ligne attend la deuxième touche : `↵` garde la lettre seule, `Retour arrière` recommence.+</Step><Step>@@ -88,7 +140,8 @@ Les raccourcis ne sont enregistrés que sur l'appareil utilisé. Sur un autre orL'enregistrement refuse certaines combinaisons et en indique la raison sous les touches :-- une combinaison déjà attribuée à une autre action ;+- une combinaison déjà attribuée à une autre action. Une touche seule entre aussi en conflit avec toute séquence qui commence par elle : tant qu'Aller à la boîte de réception vaut `G` puis `I`, aucune autre action ne peut être `G` seul ;+- une séquence sur une action hors **Navigation**, ou dont la première touche n'est pas une simple lettre, un chiffre ou un symbole ;- les combinaisons réservées au navigateur, à la fenêtre de bureau ou au système, comme `⌘W`, `⌘R`, `⌘Q`, `⌘,`, les touches d'édition (copier, coller…), `⌘0`–`⌘9` et les touches de zoom. Dans un navigateur, `⌘P`, `⌘L`, `⌘T`, `⌘N`, `⌘D` et `⌘U` sont aussi exclus ; l'application de bureau les accepte. Sous Windows et Linux, toute combinaison avec la touche Windows / Super est refusée ;- les actions qui fonctionnent aussi dans un champ de saisie, comme Ouvrir la recherche, la fenêtre de discussion ou Rechercher dans la tâche, exigent `⌘`, `Ctrl` ou `Control`, pour ne jamais se déclencher pendant la frappe ; La saisie vocale accepte aussi `Option` / `Alt` avec une touche non imprimable, comme `Space`, sauf si la combinaison est réservée.- **Envoyer** ne peut être que `↵` ou `⌘↵`.diff --git a/apps/docs/content/docs/shortcuts.ja.mdx b/apps/docs/content/docs/shortcuts.ja.mdxindex 340170cd40..564ccc58bb 100644--- a/apps/docs/content/docs/shortcuts.ja.mdx+++ b/apps/docs/content/docs/shortcuts.ja.mdx@@ -1,6 +1,6 @@---title: 検索・ショートカット・環境設定-description: ⌘K で検索やコマンドを実行し、キーボードショートカットを確認・変更し、タスク内の文字を探し、テーマ・言語・タイムゾーンなどの個人設定を調整します。+description: ⌘K で検索やコマンドを実行し、キーボードでタスクやリストを操作し、キーボードショートカットを確認・変更し、タスク内の文字を探し、テーマ・言語・タイムゾーンなどの個人設定を調整します。---import { Callout } from "fumadocs-ui/components/callout";@@ -27,8 +27,11 @@ import { Step, Steps } from "fumadocs-ui/components/steps";## キーボードショートカット+入力欄の外ならどこでも `?` を押すと、すべてのショートカットを一覧できます。今いるページで使えるグループが **現在のページ** の印付きで先頭に並び、上部の欄に入力すると名前で絞り込めます。下部のリンクから **設定 → ショートカット** を開けます。+| 操作 | macOS | Windows / Linux | 補足 ||---|---|---|---|+| キーボードショートカットを表示 | `?` | `?` | || 検索を開く | `⌘K` | `Ctrl+K` | || タスクを作成 | `C` | `C` | 普段使う作成方法が開きます。プロジェクトのページで押すと、そのプロジェクトがあらかじめ入ります。 || 左サイドバーを切り替え | `⌘B` | `Ctrl+B` | |@@ -47,9 +50,56 @@ import { Step, Steps } from "fumadocs-ui/components/steps";| 戻る | `⌘[` | `Ctrl+[` | || 進む | `⌘]` | `Ctrl+]` | |-1 キーだけのショートカット(`C`、`E`、`H`、`U`、`J`、`K`、`Z`)と「戻る」「進む」は、入力欄で文字を打っている間は反応しません。+1 キーだけのショートカットと「戻る」「進む」は、入力欄で文字を打っている間は反応しません。++### ページへ移動++`G` を押し、1.5 秒以内に 2 つ目のキーを押します。++| キー | 移動先 |+|---|---|+| `G` `I` | インボックス |+| `G` `M` | 自分のタスク |+| `G` `T` | タスク |+| `G` `P` | プロジェクト |+| `G` `C` | チャット |+| `G` `A` | エージェント |-**ナビゲーション**には、インボックス、チャット、自分のタスク、タスク、プロジェクト、自動化、エージェント、Squads、使用量、ランタイム、Skills、設定へ移動する操作もあります。どれも既定ではキーが割り当てられていないので、よく使うものに設定してください。インボックスへの移動で開くのはインボックスページで、通知のリスト自体は作業パネルの、ピン留め済みのすぐ下のセクションにあります。自分のタスクへの移動で開くのはマイタスクのページで、作業パネルの **自分の作業** ビューとは別のものです。+設定の **ナビゲーション** には、自動化、Squads、使用量、ランタイム、Skills、設定へ移動する操作もあり、既定ではキーがありません。よく使うものに設定してください。インボックスへの移動で開くのはインボックスページで、通知のリスト自体は作業パネルの、ピン留め済みのすぐ下のセクションにあります。自分のタスクへの移動で開くのはマイタスクのページで、作業パネルの **自分の作業** ビューとは別のものです。++`G` が 2 つ目のキーを待っている間、そのキーは移動に使われます。`G` のあとの `P` は優先度の設定ではなく、プロジェクトを開きます。ほかのキーを押すと待機が終わり、そのキー本来の操作になります。++### タスクを操作する++これらのキーは目の前のタスクに働きます。開いているタスクのページ、サイドプレビューのタスク、リストで選択したタスク、またはリストのカーソルがある行です。それぞれ検索欄の対応するコマンドと同じピッカーを、そのタスクや選択に合わせた状態で開きます。++| 操作 | キー | 補足 |+|---|---|---|+| ステータスを変更 | `S` | |+| 担当者を設定 | `A` | |+| 優先度を設定 | `P` | |+| ラベルを編集 | `L` | |+| 期限を設定 | `⇧D` | Windows と Linux では `Shift+D`。 |+| プロジェクトに移動 | `⇧P` | Windows と Linux では `Shift+P`。 |+| クイックアクションを実行 | `Q` | 1 件のタスクで、ワークスペースに有効なクイックアクションがあるとき。 |+| 返信 | `R` | 開いているタスクのコメント欄にカーソルを移します。 |++ゲストが使えるのは `R` だけです。++### リストとボードを移動する++タスクのリスト、テーブル、ボードでは、次のキーでタスクの間をカーソルが動きます。これらのキーは変更できません。マウスで行を指すとカーソルはその行に移って隠れ、次のキーはその行から続きます。++| 操作 | macOS | Windows / Linux | 補足 |+|---|---|---|---|+| 下 / 上へ移動 | `J` / `K`、または `↓` / `↑` | `J` / `K`、または `↓` / `↑` | 最初の 1 回は先頭から、上へ押したときは末尾から始まります。 |+| ボードの列を移動 | `←` / `→` | `←` / `→` | ボードのみ。ボードのサイドプレビューでは `H` / `L` も同じです。 |+| 開く | `↵` | `Enter` | 環境設定の **タスクを開く** に従って開きます。 |+| プレビュー | `Space` | `Space` | サイドプレビューを開閉します。 |+| 選択 | `X` | `X` | タスクを選択に加える、または外します。 |+| 選択を広げる | `⇧↓` / `⇧↑` | `Shift+↓` / `Shift+↑` | |+| すべて選択 | `⌘A` | `Ctrl+A` | カーソルが表示されているか、選択があるとき。 |+| 選択を解除 | `Esc` | `Esc` | もう一度 `Esc` を押すとカーソルが隠れます。 |### 固定のシステムショートカット@@ -76,6 +126,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";操作の右側にあるキーをクリックし、「キーを入力」と表示されたら新しい組み合わせを押します。`Esc` でキャンセル、`Delete` でその操作のキーを消去します。+**ナビゲーション** の操作では、`G` のあとに `U` のように 2 つのキーを続けて登録することもできます。1 文字押すと行は 2 つ目のキーを待ちます。`↵` で 1 文字のまま確定し、`Backspace` でやり直します。+</Step><Step>@@ -88,7 +140,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";次のような組み合わせは登録できず、キーの下に理由が表示されます。-- すでにほかの操作に割り当てられている組み合わせ。+- すでにほかの操作に割り当てられている組み合わせ。1 つのキーは、そのキーで始まる連続キーとも競合します。インボックスへの移動が `G` → `I` の間は、ほかの操作に `G` だけを割り当てられません。+- **ナビゲーション** 以外の操作の連続キーや、1 つ目が普通の文字・数字・記号でない連続キー。- ブラウザ、デスクトップウィンドウ、OS が使う組み合わせ。たとえば `⌘W`、`⌘R`、`⌘Q`、`⌘,`、コピー・貼り付けなどの編集キー、`⌘0`–`⌘9`、ズームのキーです。ブラウザでは `⌘P`、`⌘L`、`⌘T`、`⌘N`、`⌘D`、`⌘U` も使えませんが、デスクトップアプリでは使えます。Windows と Linux では、Win / Super キーを含む組み合わせはすべて使えません。- 検索を開く、チャットウィンドウを切り替え、タスク内を検索のように入力欄でも働く操作には、`⌘`、`Ctrl`、`Control` のいずれかが必要です。文字入力中に誤って発動しないためです。 音声入力では、予約済みの組み合わせを除き、`Option` / `Alt` と `Space` などの文字を入力しないキーも使えます。- **送信**に使えるのは `↵` か `⌘↵` だけです。diff --git a/apps/docs/content/docs/shortcuts.ko.mdx b/apps/docs/content/docs/shortcuts.ko.mdxindex 6a1479db1b..1f12369cbb 100644--- a/apps/docs/content/docs/shortcuts.ko.mdx+++ b/apps/docs/content/docs/shortcuts.ko.mdx@@ -1,6 +1,6 @@---title: 검색, 단축키, 환경설정-description: ⌘K로 검색하고 명령을 실행하며, 키보드 단축키를 확인하고 바꾸고, 태스크 안에서 텍스트를 찾고, 테마·언어·시간대 같은 개인 설정을 조정합니다.+description: ⌘K로 검색하고 명령을 실행하며, 키보드로 태스크와 목록을 다루고, 키보드 단축키를 확인하고 바꾸고, 태스크 안에서 텍스트를 찾고, 테마·언어·시간대 같은 개인 설정을 조정합니다.---import { Callout } from "fumadocs-ui/components/callout";@@ -27,8 +27,11 @@ import { Step, Steps } from "fumadocs-ui/components/steps";## 키보드 단축키+입력란 밖이라면 어디서든 `?`를 누르면 모든 단축키를 볼 수 있습니다. 지금 페이지에서 쓰는 그룹이 **현재 페이지** 표시와 함께 맨 앞에 오고, 위쪽 칸에 입력하면 이름으로 걸러 볼 수 있습니다. 아래쪽 링크는 **설정 → 단축키**를 엽니다.+| 동작 | macOS | Windows / Linux | 참고 ||---|---|---|---|+| 키보드 단축키 보기 | `?` | `?` | || 검색 열기 | `⌘K` | `Ctrl+K` | || 태스크 만들기 | `C` | `C` | 평소 쓰는 생성 방식을 엽니다. 프로젝트 페이지에서 누르면 그 프로젝트가 미리 채워집니다. || 왼쪽 사이드바 전환 | `⌘B` | `Ctrl+B` | |@@ -47,9 +50,56 @@ import { Step, Steps } from "fumadocs-ui/components/steps";| 뒤로 가기 | `⌘[` | `Ctrl+[` | || 앞으로 가기 | `⌘]` | `Ctrl+]` | |-키 하나짜리 단축키(`C`, `E`, `H`, `U`, `J`, `K`, `Z`)와 뒤로 가기·앞으로 가기는 입력란에서 글을 쓰는 동안에는 동작하지 않습니다.+키 하나짜리 단축키와 뒤로 가기·앞으로 가기는 입력란에서 글을 쓰는 동안에는 동작하지 않습니다.++### 페이지로 이동++`G`를 누른 뒤 1.5초 안에 두 번째 키를 누릅니다.++| 키 | 이동할 곳 |+|---|---|+| `G` `I` | 인박스 |+| `G` `M` | 내 태스크 |+| `G` `T` | 태스크 |+| `G` `P` | 프로젝트 |+| `G` `C` | 채팅 |+| `G` `A` | 에이전트 |-**탐색** 그룹에는 인박스, 채팅, 내 태스크, 태스크, 프로젝트, 자동화, 에이전트, 스쿼드, 사용량, 런타임, Skills, 설정으로 이동하는 동작도 있습니다. 모두 기본 키가 없으니 자주 쓰는 것에 직접 지정하세요. 인박스로 이동하면 인박스 페이지가 열리며, 알림 목록 자체는 작업 패널에서 고정됨 바로 아래 섹션에 있습니다. 내 태스크로 이동하면 내 태스크 페이지가 열리며, 작업 패널의 **내 작업** 뷰와는 다릅니다.+설정의 **탐색** 그룹에는 자동화, 스쿼드, 사용량, 런타임, Skills, 설정으로 이동하는 동작도 있으며 기본 키는 없습니다. 자주 쓰는 것에 직접 지정하세요. 인박스로 이동하면 인박스 페이지가 열리며, 알림 목록 자체는 작업 패널에서 고정됨 바로 아래 섹션에 있습니다. 내 태스크로 이동하면 내 태스크 페이지가 열리며, 작업 패널의 **내 작업** 뷰와는 다릅니다.++`G`가 두 번째 키를 기다리는 동안 그 키는 이동에 쓰입니다. `G` 다음의 `P`는 우선순위 설정이 아니라 프로젝트를 엽니다. 다른 키를 누르면 기다림이 끝나고 그 키는 원래대로 동작합니다.++### 태스크 다루기++이 키들은 눈앞의 태스크에 동작합니다. 열려 있는 태스크 페이지, 사이드 미리보기의 태스크, 목록에서 선택한 태스크, 또는 목록 커서가 있는 행입니다. 각 키는 검색창의 해당 명령과 같은 선택기를, 그 태스크나 선택에 맞춘 상태로 엽니다.++| 동작 | 키 | 참고 |+|---|---|---|+| 상태 변경 | `S` | |+| 담당자 지정 | `A` | |+| 우선순위 설정 | `P` | |+| 라벨 편집 | `L` | |+| 마감일 설정 | `⇧D` | Windows와 Linux에서는 `Shift+D`. |+| 프로젝트로 이동 | `⇧P` | Windows와 Linux에서는 `Shift+P`. |+| 빠른 작업 실행 | `Q` | 태스크 하나에서, 워크스페이스에 활성화된 빠른 작업이 있을 때. |+| 답글 | `R` | 열린 태스크의 댓글 입력란으로 커서를 옮깁니다. |++게스트는 `R`만 쓸 수 있습니다.++### 목록과 보드에서 이동++태스크 목록, 표, 보드에서는 아래 키로 태스크 사이를 커서가 움직입니다. 이 키들은 바꿀 수 없습니다. 마우스로 행을 가리키면 커서가 그 행으로 옮겨 가 숨고, 다음 키는 그 행에서 이어집니다.++| 동작 | macOS | Windows / Linux | 참고 |+|---|---|---|---|+| 아래 / 위로 이동 | `J` / `K` 또는 `↓` / `↑` | `J` / `K` 또는 `↓` / `↑` | 처음 누르면 맨 위에서, 위로 누르면 맨 아래에서 시작합니다. |+| 보드 열 이동 | `←` / `→` | `←` / `→` | 보드에서만. 보드의 사이드 미리보기에서는 `H` / `L`도 같습니다. |+| 열기 | `↵` | `Enter` | 환경설정의 **태스크 열기**에 따라 엽니다. |+| 미리보기 | `Space` | `Space` | 사이드 미리보기를 열거나 닫습니다. |+| 선택 | `X` | `X` | 태스크를 선택에 넣거나 뺍니다. |+| 선택 확장 | `⇧↓` / `⇧↑` | `Shift+↓` / `Shift+↑` | |+| 모두 선택 | `⌘A` | `Ctrl+A` | 커서가 보이거나 선택한 것이 있을 때. |+| 선택 해제 | `Esc` | `Esc` | `Esc`를 한 번 더 누르면 커서가 숨습니다. |### 고정 시스템 단축키@@ -76,6 +126,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";동작 오른쪽의 키를 클릭하고 '키를 누르세요'가 보이면 새 조합을 누릅니다. `Esc`는 취소, `Delete`는 그 동작의 키를 지웁니다.+**탐색** 동작에는 `G` 다음 `U`처럼 키 두 개를 이어서 기록할 수도 있습니다. 글자 하나를 누르면 행이 두 번째 키를 기다립니다. `↵`는 글자 하나로 확정하고, `Backspace`는 처음부터 다시 합니다.+</Step><Step>@@ -88,7 +140,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";다음 조합은 등록되지 않으며, 키 아래에 이유가 표시됩니다.-- 이미 다른 동작에 지정된 조합.+- 이미 다른 동작에 지정된 조합. 키 하나는 그 키로 시작하는 연속 키와도 겹칩니다. 인박스로 이동이 `G` 다음 `I`인 동안에는 다른 동작에 `G` 하나만 지정할 수 없습니다.+- **탐색**이 아닌 동작의 연속 키, 또는 첫 키가 일반 글자·숫자·기호가 아닌 연속 키.- 브라우저, 데스크톱 창, 운영체제가 쓰는 조합. 예를 들어 `⌘W`, `⌘R`, `⌘Q`, `⌘,`, 복사·붙여넣기 같은 편집 키, `⌘0`–`⌘9`, 확대/축소 키입니다. 브라우저에서는 `⌘P`, `⌘L`, `⌘T`, `⌘N`, `⌘D`, `⌘U`도 쓸 수 없지만 데스크톱 앱에서는 쓸 수 있습니다. Windows와 Linux에서는 Win / Super 키가 들어간 조합을 모두 쓸 수 없습니다.- 검색 열기, 채팅 창 전환, 태스크에서 찾기처럼 입력란에서도 동작하는 단축키에는 `⌘`, `Ctrl`, `Control` 중 하나가 있어야 합니다. 글을 쓰다가 잘못 실행되지 않게 하기 위해서입니다. 음성 입력은 예약된 조합이 아니라면 `Option` / `Alt`와 `Space`처럼 문자를 입력하지 않는 키의 조합도 허용합니다.- **보내기**에는 `↵`나 `⌘↵`만 쓸 수 있습니다.diff --git a/apps/docs/content/docs/shortcuts.mdx b/apps/docs/content/docs/shortcuts.mdxindex 233eaced9f..051201fbdf 100644--- a/apps/docs/content/docs/shortcuts.mdx+++ b/apps/docs/content/docs/shortcuts.mdx@@ -1,6 +1,6 @@---title: Search, shortcuts, and preferences-description: Search and run commands with ⌘K, review and rebind keyboard shortcuts, find text inside an issue, and set personal preferences such as theme, language, and time zone.+description: Search and run commands with ⌘K, drive issues and lists from the keyboard, review and rebind keyboard shortcuts, find text inside an issue, and set personal preferences such as theme, language, and time zone.---import { Callout } from "fumadocs-ui/components/callout";@@ -27,8 +27,11 @@ Selecting a result opens it. Hold `⌘` (`Ctrl` on Windows and Linux) while clic## Keyboard shortcuts+Press `?` anywhere outside a text field to see every shortcut. The groups for the page you're on come first, marked **current page**; type in the box at the top to filter by name. The link at the bottom opens **Settings → Shortcuts**.+| Action | macOS | Windows / Linux | Notes ||---|---|---|---|+| Show keyboard shortcuts | `?` | `?` | || Open search | `⌘K` | `Ctrl+K` | || Create issue | `C` | `C` | Opens your preferred creation flow. On a project page, the new issue is prefilled with that project. || Toggle left sidebar | `⌘B` | `Ctrl+B` | |@@ -47,9 +50,56 @@ Selecting a result opens it. Hold `⌘` (`Ctrl` on Windows and Linux) while clic| Go back | `⌘[` | `Ctrl+[` | || Go forward | `⌘]` | `Ctrl+]` | |-Single-key shortcuts (`C`, `E`, `H`, `U`, `J`, `K`, `Z`) and Go back / Go forward don't fire while you're typing in an input.+Single-key shortcuts and Go back / Go forward don't fire while you're typing in an input.++### Go to a page++Press `G`, then a second key, within a second and a half:++| Keys | Goes to |+|---|---|+| `G` `I` | Inbox |+| `G` `M` | My Issues |+| `G` `T` | Issues |+| `G` `P` | Projects |+| `G` `C` | Chat |+| `G` `A` | Agents |-The **Navigation** group also has Go to Inbox, Chat, My Issues, Issues, Projects, Autopilot, Agents, Squads, Usage, Runtimes, Skills, and Settings. None of them has a key by default; bind the ones you use. Go to Inbox opens the Inbox page; the notification list itself is a section of the Work panel, right below Pinned. Go to My Issues opens the My Issues page, which is not the same as the **My work** view in the Work panel.+The **Navigation** group in Settings also has Go to Autopilot, Squads, Usage, Runtimes, Skills, and Settings, with no key by default; bind the ones you use. Go to Inbox opens the Inbox page; the notification list itself is a section of the Work panel, right below Pinned. Go to My Issues opens the My Issues page, which is not the same as the **My work** view in the Work panel.++While `G` waits for its second key, that key belongs to the sequence: `G` then `P` opens Projects instead of setting a priority. Any other key ends the wait and does what it normally does.++### Act on an issue++These work on the issue in front of you: the open issue page, the issue in a side preview, the issues you selected in a list, or the row the list cursor is on. Each opens the same picker as the matching command in the search box, already on that issue or selection.++| Action | Key | Notes |+|---|---|---|+| Change status | `S` | |+| Assign | `A` | |+| Set priority | `P` | |+| Edit labels | `L` | |+| Set due date | `⇧D` | `Shift+D` on Windows and Linux. |+| Move to project | `⇧P` | `Shift+P` on Windows and Linux. |+| Run quick action | `Q` | On a single issue, when the workspace has active quick actions. |+| Reply | `R` | Puts the cursor in the open issue's comment box. |++Guests can only use `R`.++### Move through lists and boards++On an issue list, table, or board, the keys below move a cursor over the issues. They can't be rebound. Pointing at a row moves the cursor there and hides it; the next key carries on from that row.++| Action | macOS | Windows / Linux | Notes |+|---|---|---|---|+| Move down / up | `J` / `K`, or `↓` / `↑` | `J` / `K`, or `↓` / `↑` | The first press starts at the top, or at the bottom going up. |+| Move across board columns | `←` / `→` | `←` / `→` | On a board only. In a board's side preview, `H` / `L` do the same. |+| Open | `↵` | `Enter` | Opens the issue the way **Opening issues** in Preferences says. |+| Preview | `Space` | `Space` | Opens or closes the side preview. |+| Select | `X` | `X` | Adds the issue to the selection, or takes it out. |+| Extend selection | `⇧↓` / `⇧↑` | `Shift+↓` / `Shift+↑` | |+| Select all | `⌘A` | `Ctrl+A` | Once the cursor is showing or something is selected. |+| Clear selection | `Esc` | `Esc` | A second `Esc` hides the cursor. |### Fixed system shortcuts@@ -76,6 +126,8 @@ Open **Settings → Shortcuts**. Use the search box at the top to find an actionClick the keys to the right of an action. When it says "Press keys", press the new combination. `Esc` cancels; `Delete` clears the action's shortcut.+For a **Navigation** action you can also record two keys in a row, such as `G` then `U`. After a single letter the row waits for the second key: `↵` keeps the single letter, `Backspace` starts over.+</Step><Step>@@ -88,7 +140,8 @@ Shortcuts are saved on the current device only. On another computer, or when youRecording rejects a few kinds of combinations and says why under the keys:-- A combination already assigned to another action.+- A combination already assigned to another action. A single key also clashes with any sequence that starts with it: while Go to Inbox is `G` then `I`, no other action can be `G` on its own.+- A sequence on anything but a **Navigation** action, or one whose first key isn't a plain letter, digit, or symbol.- Combinations the browser, the desktop window, or the operating system owns, such as `⌘W`, `⌘R`, `⌘Q`, `⌘,`, editing keys like copy and paste, `⌘0`–`⌘9`, and the zoom keys. In a browser, `⌘P`, `⌘L`, `⌘T`, `⌘N`, `⌘D`, and `⌘U` are off-limits too; the desktop app allows them. On Windows and Linux, any combination with the Win / Super key is rejected.- Actions that also work inside an input, such as Open search, Toggle chat window, and Find in issue, need `⌘`, `Ctrl`, or `Control`, so they never fire while you type. Voice input also accepts `Option` / `Alt` with a non-printing key, such as `Space`, unless the combination is reserved.- **Send** can only be `↵` or `⌘↵`.diff --git a/apps/docs/content/docs/shortcuts.zh-Hant.mdx b/apps/docs/content/docs/shortcuts.zh-Hant.mdxindex 5693c8a83f..e2e23c317c 100644--- a/apps/docs/content/docs/shortcuts.zh-Hant.mdx+++ b/apps/docs/content/docs/shortcuts.zh-Hant.mdx@@ -1,6 +1,6 @@---title: 搜尋、快捷鍵與偏好設定-description: 用 ⌘K 搜尋和執行命令,檢視和修改鍵盤快捷鍵,在任務裡查詢文字,調整主題、語言、時區等個人偏好。+description: 用 ⌘K 搜尋和執行命令,用鍵盤處理任務和列表,檢視和修改鍵盤快捷鍵,在任務裡查詢文字,調整主題、語言、時區等個人偏好。---import { Callout } from "fumadocs-ui/components/callout";@@ -27,8 +27,11 @@ import { Step, Steps } from "fumadocs-ui/components/steps";## 鍵盤快捷鍵+在輸入框以外的任何地方按 `?`,可以看到全部快捷鍵。目前頁面用得上的分組排在最前面,標著**目前頁面**;在頂部的框裡輸入可以按名稱篩選。底部的連結開啟**設定 → 快捷鍵**。+| 操作 | macOS | Windows / Linux | 說明 ||---|---|---|---|+| 顯示快捷鍵 | `?` | `?` | || 開啟搜尋 | `⌘K` | `Ctrl+K` | || 新建任務 | `C` | `C` | 開啟你常用的建立方式。在專案頁按,新任務會預先填好這個專案。 || 顯示或隱藏左側邊欄 | `⌘B` | `Ctrl+B` | |@@ -47,9 +50,56 @@ import { Step, Steps } from "fumadocs-ui/components/steps";| 後退 | `⌘[` | `Ctrl+[` | || 前進 | `⌘]` | `Ctrl+]` | |-單鍵快捷鍵(`C`、`E`、`H`、`U`、`J`、`K`、`Z`)和後退、前進在輸入框裡不起作用,避免打字時誤觸。+單鍵快捷鍵和後退、前進在輸入框裡不起作用,避免打字時誤觸。++### 前往頁面++先按 `G`,再在一秒半內按第二個鍵:++| 按鍵 | 前往 |+|---|---|+| `G` `I` | 收件箱 |+| `G` `M` | 我的任務 |+| `G` `T` | 任務 |+| `G` `P` | 專案 |+| `G` `C` | 聊天 |+| `G` `A` | AI 代理 |-**導航**類操作還有前往收件箱、聊天、我的任務、任務、專案、自動化、AI 代理、小隊、統計、執行時、Skills 和設定,預設都沒有設定按鍵,需要時自己繫結。前往收件箱開啟的是收件箱頁面,通知列表本身是工作面板裡的一個分區,就在固定下面。前往我的任務開啟的是"我的任務"頁面,和工作面板裡的**我的工作**檢視不是一回事。+設定裡的**導航**類還有前往自動化、小隊、統計、執行時、Skills 和設定,預設沒有按鍵,需要時自己繫結。前往收件箱開啟的是收件箱頁面,通知列表本身是工作面板裡的一個分區,就在固定下面。前往我的任務開啟的是"我的任務"頁面,和工作面板裡的**我的工作**檢視不是一回事。++`G` 等第二個鍵的時候,這個鍵歸這組按鍵:`G` 再按 `P` 會開啟專案,而不是設定優先級。按別的鍵就結束等待,那個鍵照常生效。++### 處理任務++這些按鍵作用於你眼前的任務:開啟的任務詳情頁、懸浮預覽裡的任務、列表裡選取的任務,或列表游標所在的那一行。每個鍵開啟的選擇器和搜尋框裡對應的命令一樣,並且已經對準這個任務或這些選取項。++| 操作 | 按鍵 | 說明 |+|---|---|---|+| 變更狀態 | `S` | |+| 指派負責人 | `A` | |+| 設定優先級 | `P` | |+| 編輯標籤 | `L` | |+| 設定截止日期 | `⇧D` | Windows 和 Linux 上是 `Shift+D`。 |+| 移動到專案 | `⇧P` | Windows 和 Linux 上是 `Shift+P`。 |+| 執行快捷操作 | `Q` | 針對單個任務,工作區裡有啟用的快捷操作時可用。 |+| 回覆 | `R` | 把游標放進目前任務的評論框。 |++訪客只能用 `R`。++### 在列表和看板中移動++在任務列表、表格或看板上,下面的鍵會在任務之間移動一個游標。這些鍵不能改。滑鼠指向某一行時,游標移到那一行並隱藏;下一次按鍵從那一行接著走。++| 操作 | macOS | Windows / Linux | 說明 |+|---|---|---|---|+| 下移 / 上移 | `J` / `K`,或 `↓` / `↑` | `J` / `K`,或 `↓` / `↑` | 第一次按從頂部開始,往上按則從底部開始。 |+| 在看板欄之間移動 | `←` / `→` | `←` / `→` | 只在看板上。看板的懸浮預覽裡,`H` / `L` 作用相同。 |+| 開啟 | `↵` | `Enter` | 按偏好設定裡**開啟任務**的方式開啟。 |+| 預覽 | `Space` | `Space` | 開啟或關閉懸浮預覽。 |+| 選取 | `X` | `X` | 把任務加入選取,或從選取裡去掉。 |+| 擴展選取 | `⇧↓` / `⇧↑` | `Shift+↓` / `Shift+↑` | |+| 全選 | `⌘A` | `Ctrl+A` | 游標已顯示或已有選取項時可用。 |+| 取消選取 | `Esc` | `Esc` | 再按一次 `Esc` 隱藏游標。 |### 固定的系統快捷鍵@@ -76,6 +126,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";點選某個操作右側的按鍵,看到"請按鍵"後按下新的組合。`Esc` 取消,`Delete` 清除這個操作的按鍵。+**導航**類操作還可以錄兩個連按的鍵,例如 `G` 再按 `U`。按下一個字母後,這一行會等第二個鍵:`↵` 保留單個字母,`Backspace` 重新開始。+</Step><Step>@@ -88,7 +140,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";錄入時會拒絕幾類組合,並在按鍵下方說明原因:-- 已經分給其他操作的組合。+- 已經分給其他操作的組合。單個鍵也會和以它開頭的連按衝突:前往收件箱是 `G` 再按 `I` 時,其他操作不能單獨用 `G`。+- 非**導航**類操作的連按,或者第一個鍵不是普通字母、數字或符號的連按。- 瀏覽器、桌面視窗或系統佔用的組合,例如 `⌘W`、`⌘R`、`⌘Q`、`⌘,`、複製貼上這類編輯鍵、`⌘0`–`⌘9` 和縮放鍵。網頁版裡 `⌘P`、`⌘L`、`⌘T`、`⌘N`、`⌘D`、`⌘U` 也不能用,桌面端可以。Windows 和 Linux 上帶 Win / Super 鍵的組合都不能用。- 開啟搜尋、聊天窗、在任務中查詢這類在輸入框裡也生效的操作,必須帶 `⌘`、`Ctrl` 或 `Control`,否則打字時會誤觸。 語音輸入也允許 `Option` / `Alt` 加 `Space` 等不輸入文字的按鍵,但不能使用已被佔用的組合。- **傳送**只能是 `↵` 或 `⌘↵`。diff --git a/apps/docs/content/docs/shortcuts.zh.mdx b/apps/docs/content/docs/shortcuts.zh.mdxindex 502fa2529b..b3d0618881 100644--- a/apps/docs/content/docs/shortcuts.zh.mdx+++ b/apps/docs/content/docs/shortcuts.zh.mdx@@ -1,6 +1,6 @@---title: 搜索、快捷键与偏好设置-description: 用 ⌘K 搜索和执行命令,查看和修改键盘快捷键,在任务里查找文字,调整主题、语言、时区等个人偏好。+description: 用 ⌘K 搜索和执行命令,用键盘处理任务和列表,查看和修改键盘快捷键,在任务里查找文字,调整主题、语言、时区等个人偏好。---import { Callout } from "fumadocs-ui/components/callout";@@ -27,8 +27,11 @@ import { Step, Steps } from "fumadocs-ui/components/steps";## 键盘快捷键+在输入框以外的任何地方按 `?`,可以看到全部快捷键。当前页面用得上的分组排在最前面,标着**当前页面**;在顶部的框里输入可以按名称筛选。底部的链接打开**设置 → 快捷键**。+| 操作 | macOS | Windows / Linux | 说明 ||---|---|---|---|+| 显示快捷键 | `?` | `?` | || 打开搜索 | `⌘K` | `Ctrl+K` | || 新建任务 | `C` | `C` | 打开你常用的创建方式。在项目页按,新任务会预先填好这个项目。 || 显示或隐藏左侧边栏 | `⌘B` | `Ctrl+B` | |@@ -47,9 +50,56 @@ import { Step, Steps } from "fumadocs-ui/components/steps";| 后退 | `⌘[` | `Ctrl+[` | || 前进 | `⌘]` | `Ctrl+]` | |-单键快捷键(`C`、`E`、`H`、`U`、`J`、`K`、`Z`)和后退、前进在输入框里不起作用,避免打字时误触。+单键快捷键和后退、前进在输入框里不起作用,避免打字时误触。++### 前往页面++先按 `G`,再在一秒半内按第二个键:++| 按键 | 前往 |+|---|---|+| `G` `I` | 收件箱 |+| `G` `M` | 我的任务 |+| `G` `T` | 任务 |+| `G` `P` | 项目 |+| `G` `C` | 聊天 |+| `G` `A` | 智能体 |-**导航**类操作还有前往收件箱、聊天、我的任务、任务、项目、自动化、智能体、小队、统计、运行时、Skills 和设置,默认都没有设置按键,需要时自己绑定。前往收件箱打开的是收件箱页面,通知列表本身是工作面板里的一个分区,就在固定下面。前往我的任务打开的是"我的任务"页面,和工作面板里的**我的工作**视图不是一回事。+设置里的**导航**类还有前往自动化、小队、统计、运行时、Skills 和设置,默认没有按键,需要时自己绑定。前往收件箱打开的是收件箱页面,通知列表本身是工作面板里的一个分区,就在固定下面。前往我的任务打开的是"我的任务"页面,和工作面板里的**我的工作**视图不是一回事。++`G` 等第二个键的时候,这个键归这组按键:`G` 再按 `P` 会打开项目,而不是设置优先级。按别的键就结束等待,那个键照常生效。++### 处理任务++这些按键作用于你眼前的任务:打开的任务详情页、悬浮预览里的任务、列表里选中的任务,或列表光标所在的那一行。每个键打开的选择器和搜索框里对应的命令一样,并且已经对准这个任务或这些选中项。++| 操作 | 按键 | 说明 |+|---|---|---|+| 更改状态 | `S` | |+| 指派负责人 | `A` | |+| 设置优先级 | `P` | |+| 编辑标签 | `L` | |+| 设置截止日期 | `⇧D` | Windows 和 Linux 上是 `Shift+D`。 |+| 移动到项目 | `⇧P` | Windows 和 Linux 上是 `Shift+P`。 |+| 运行快捷操作 | `Q` | 针对单个任务,工作区里有启用的快捷操作时可用。 |+| 回复 | `R` | 把光标放进当前任务的评论框。 |++访客只能用 `R`。++### 在列表和看板中移动++在任务列表、表格或看板上,下面的键会在任务之间移动一个光标。这些键不能改。鼠标指向某一行时,光标移到那一行并隐藏;下一次按键从那一行接着走。++| 操作 | macOS | Windows / Linux | 说明 |+|---|---|---|---|+| 下移 / 上移 | `J` / `K`,或 `↓` / `↑` | `J` / `K`,或 `↓` / `↑` | 第一次按从顶部开始,往上按则从底部开始。 |+| 在看板列之间移动 | `←` / `→` | `←` / `→` | 只在看板上。看板的悬浮预览里,`H` / `L` 作用相同。 |+| 打开 | `↵` | `Enter` | 按偏好设置里**打开任务**的方式打开。 |+| 预览 | `Space` | `Space` | 打开或关闭悬浮预览。 |+| 选中 | `X` | `X` | 把任务加入选择,或从选择里去掉。 |+| 扩展选择 | `⇧↓` / `⇧↑` | `Shift+↓` / `Shift+↑` | |+| 全选 | `⌘A` | `Ctrl+A` | 光标已显示或已有选中项时可用。 |+| 取消选择 | `Esc` | `Esc` | 再按一次 `Esc` 隐藏光标。 |### 固定的系统快捷键@@ -76,6 +126,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";点击某个操作右侧的按键,看到"请按键"后按下新的组合。`Esc` 取消,`Delete` 清除这个操作的按键。+**导航**类操作还可以录两个连按的键,例如 `G` 再按 `U`。按下一个字母后,这一行会等第二个键:`↵` 保留单个字母,`Backspace` 重新开始。+</Step><Step>@@ -88,7 +140,8 @@ import { Step, Steps } from "fumadocs-ui/components/steps";录入时会拒绝几类组合,并在按键下方说明原因:-- 已经分给其他操作的组合。+- 已经分给其他操作的组合。单个键也会和以它开头的连按冲突:前往收件箱是 `G` 再按 `I` 时,其他操作不能单独用 `G`。+- 非**导航**类操作的连按,或者第一个键不是普通字母、数字或符号的连按。- 浏览器、桌面窗口或系统占用的组合,例如 `⌘W`、`⌘R`、`⌘Q`、`⌘,`、复制粘贴这类编辑键、`⌘0`–`⌘9` 和缩放键。网页版里 `⌘P`、`⌘L`、`⌘T`、`⌘N`、`⌘D`、`⌘U` 也不能用,桌面端可以。Windows 和 Linux 上带 Win / Super 键的组合都不能用。- 打开搜索、聊天窗、在任务中查找这类在输入框里也生效的操作,必须带 `⌘`、`Ctrl` 或 `Control`,否则打字时会误触。 语音输入还允许 `Option` / `Alt` 加 `Space` 等不输入文字的按键,但不能使用已被占用的组合。- **发送**只能是 `↵` 或 `⌘↵`。diff --git a/e2e/guest.spec.ts b/e2e/guest.spec.tsindex e72e701dea..d9093122fa 100644--- a/e2e/guest.spec.ts+++ b/e2e/guest.spec.ts@@ -343,6 +343,31 @@ test.describe("as a guest", () => {await expectClean(seen);});+ test("the shortcut sheet lists only a guest's keys, and G leads only to its pages", async ({ page }) => {+ const seen = await openAsGuest(page, `/${slug}/inbox`);+ await expect(page.getByRole("region", { name: "Inbox" })).toBeVisible({ timeout: 30_000 });++ await page.keyboard.press("Shift+Slash");+ const sheet = page.getByRole("dialog", { name: "Keyboard shortcuts" });+ await expect(sheet.getByText("Go to Inbox", { exact: true })).toBeVisible();+ await expect(sheet.getByText("Reply", { exact: true })).toBeVisible();+ for (const name of ["Go to Chat", "Go to Agents", "Create issue", "Change status", "Toggle chat window"]) {+ await expect(sheet.getByText(name, { exact: true })).toHaveCount(0);+ }+ await page.keyboard.press("Escape");+ await expect(sheet).toHaveCount(0);++ await page.keyboard.press("g");+ await page.keyboard.press("c");+ await page.keyboard.press("g");+ await page.keyboard.press("a");+ await expect(page).toHaveURL(new RegExp(`/${slug}/inbox`));+ await page.keyboard.press("g");+ await page.keyboard.press("p");+ await expect(page).toHaveURL(new RegExp(`/${slug}/projects$`));+ await expectClean(seen);+ });+test("a project that is not shared is not found", async ({ page }) => {const { id } = fixture.projects.internal;const seen = await openAsGuest(page, `/${slug}/projects/${id}`, { notFound: [id] });diff --git a/packages/core/modals/store.ts b/packages/core/modals/store.tsindex 1c4f33c253..2f8b0ce461 100644--- a/packages/core/modals/store.ts+++ b/packages/core/modals/store.ts@@ -19,6 +19,7 @@ type ModalType =| "issue-delete-confirm"| "issue-run-confirm"| "issue-workflow-handoff"+ | "keyboard-shortcuts"| null;// Each reason is a Cloud-enforced limit whose recovery dialog offers billingdiff --git a/packages/core/shortcuts/definitions.test.ts b/packages/core/shortcuts/definitions.test.tsindex 24ca595aef..443848b346 100644--- a/packages/core/shortcuts/definitions.test.ts+++ b/packages/core/shortcuts/definitions.test.ts@@ -1,6 +1,8 @@import { afterEach, describe, expect, it, vi } from "vitest";import {+ canStartShortcutSequence,createShortcutChord,+ createShortcutSequence,formatShortcut,isShortcutAllowedForAction,isReservedShortcut,@@ -575,3 +577,66 @@ describe("keyboard shortcut definitions", () => {expect(parseLegacyShortcut("Bogus+K")).toBeNull();});});++describe("shortcut sequences", () => {+ const seq = (first: string, then: string, thenModifiers = {}) =>+ createShortcutSequence(first, createShortcutChord(then, thenModifiers));++ it("binds G then a letter to the main pages, and ? to the shortcut sheet", () => {+ expect(SHORTCUT_ACTION_BY_ID.goInbox.defaultShortcut).toEqual(seq("G", "I"));+ expect(SHORTCUT_ACTION_BY_ID.goMyIssues.defaultShortcut).toEqual(seq("G", "M"));+ expect(SHORTCUT_ACTION_BY_ID.goIssues.defaultShortcut).toEqual(seq("G", "T"));+ expect(SHORTCUT_ACTION_BY_ID.goProjects.defaultShortcut).toEqual(seq("G", "P"));+ expect(SHORTCUT_ACTION_BY_ID.goChat.defaultShortcut).toEqual(seq("G", "C"));+ expect(SHORTCUT_ACTION_BY_ID.goAgents.defaultShortcut).toEqual(seq("G", "A"));+ expect(SHORTCUT_ACTION_BY_ID.goSettings.defaultShortcut).toBeNull();+ expect(SHORTCUT_ACTION_BY_ID.showShortcuts.defaultShortcut).toEqual(createShortcutChord("?", { shift: true }));+ for (const action of SHORTCUT_ACTIONS) {+ if (action.defaultShortcut) expect(isShortcutAllowedForAction(action.id, action.defaultShortcut)).toBe(true);+ }+ });++ it("compares both keys", () => {+ expect(shortcutChordEquals(seq("G", "I"), seq("G", "I"))).toBe(true);+ expect(shortcutChordEquals(seq("G", "I"), seq("G", "M"))).toBe(false);+ expect(shortcutChordEquals(seq("G", "I"), createShortcutChord("G"))).toBe(false);+ expect(shortcutChordEquals(createShortcutChord("G"), seq("G", "I"))).toBe(false);+ });++ it("never matches a single event", () => {+ expect(shortcutMatchesEvent(seq("G", "I"), keyEvent("g"))).toBe(false);+ expect(shortcutMatchesEvent(seq("G", "I"), keyEvent("i"))).toBe(false);+ });++ it("formats as the two keys", () => {+ expect(formatShortcut(seq("G", "I"), "macos")).toBe("G I");+ expect(formatShortcut(seq("G", "S", { shift: true }), "windows")).toBe("G Shift+S");+ });++ it("goes only to navigation, from a bare printable key to another, Shift allowed", () => {+ expect(isShortcutAllowedForAction("goSettings", seq("G", "S"))).toBe(true);+ expect(isShortcutAllowedForAction("goSettings", seq("G", "S", { shift: true }))).toBe(true);+ expect(isShortcutAllowedForAction("goSettings", seq("G", "S", { primary: true }))).toBe(false);+ expect(isShortcutAllowedForAction("goSettings", seq("G", "S", { alt: true }))).toBe(false);+ expect(isShortcutAllowedForAction("goSettings", seq("G", "Enter"))).toBe(false);+ expect(isShortcutAllowedForAction("goSettings", seq("G", "Space"))).toBe(false);+ expect(+ isShortcutAllowedForAction("goSettings", {+ ...createShortcutChord("G", { shift: true }),+ then: createShortcutChord("S"),+ }),+ ).toBe(false);+ expect(+ isShortcutAllowedForAction("goSettings", createShortcutSequence("G", seq("S", "T"))),+ ).toBe(false);+ expect(isShortcutAllowedForAction("createIssue", seq("G", "N"))).toBe(false);+ expect(isShortcutAllowedForAction("openSearch", seq("G", "K"))).toBe(false);+ });++ it("says which keys may start one", () => {+ expect(canStartShortcutSequence("goInbox", createShortcutChord("G"))).toBe(true);+ expect(canStartShortcutSequence("goInbox", createShortcutChord("G", { shift: true }))).toBe(false);+ expect(canStartShortcutSequence("goInbox", createShortcutChord("Enter"))).toBe(false);+ expect(canStartShortcutSequence("createIssue", createShortcutChord("G"))).toBe(false);+ });+});diff --git a/packages/core/shortcuts/definitions.ts b/packages/core/shortcuts/definitions.tsindex cf6f298fad..ed224828be 100644--- a/packages/core/shortcuts/definitions.ts+++ b/packages/core/shortcuts/definitions.ts@@ -28,6 +28,7 @@ export type ShortcutActionId =| "moveIssueToProject"| "runIssueQuickAction"| "replyToIssue"+ | "showShortcuts"| "send"| "voiceInput"| "goBack"@@ -62,6 +63,12 @@ export interface ShortcutChord {/** Logical key (`KeyboardEvent.key`), not physical keyboard position. */key: string;modifiers: ShortcutModifiers;+ /**+ * The key pressed after this one, for a two-key sequence such as G then I.+ * Only navigation actions take sequences (see `isShortcutAllowedForAction`),+ * and a sequence never matches a single event: `GlobalShortcuts` follows it.+ */+ then?: ShortcutChord;}export interface ShortcutActionDefinition {@@ -89,9 +96,19 @@ export function createShortcutChord(};}+/** A plain key followed by another, such as G then I. */+export function createShortcutSequence(+ first: string,+ then: ShortcutChord,+): ShortcutChord {+ return { ...createShortcutChord(first), then };+}+const primary = (key: string) =>createShortcutChord(key, { primary: true });+const go = (key: string) => createShortcutSequence("G", createShortcutChord(key));+export const SHORTCUT_ACTIONS: readonly ShortcutActionDefinition[] = [{ id: "openSearch", category: "general", defaultShortcut: primary("K"), allowInEditable: true },{ id: "createIssue", category: "general", defaultShortcut: createShortcutChord("C"), allowInEditable: false },@@ -182,6 +199,13 @@ export const SHORTCUT_ACTIONS: readonly ShortcutActionDefinition[] = [},{ id: "runIssueQuickAction", category: "issue", defaultShortcut: createShortcutChord("Q"), allowInEditable: false },{ id: "replyToIssue", category: "issue", defaultShortcut: createShortcutChord("R"), allowInEditable: false },+ // `?` is Shift+/ on most layouts, and arrives as "?" with Shift held.+ {+ id: "showShortcuts",+ category: "general",+ defaultShortcut: createShortcutChord("?", { shift: true }),+ allowInEditable: false,+ },{ id: "send", category: "general", defaultShortcut: primary("Enter"), allowInEditable: true },// Voice input works where the caret is, so it must fire inside editors. It// is matched on keydown AND keyup (holding it is push-to-talk), so the voice@@ -200,13 +224,14 @@ export const SHORTCUT_ACTIONS: readonly ShortcutActionDefinition[] = [// away from the page while the caret sits in an input, textarea, or editor.{ id: "goBack", category: "navigation", defaultShortcut: primary("["), allowInEditable: false },{ id: "goForward", category: "navigation", defaultShortcut: primary("]"), allowInEditable: false },- { id: "goInbox", category: "navigation", defaultShortcut: null, allowInEditable: false },- { id: "goChat", category: "navigation", defaultShortcut: null, allowInEditable: false },- { id: "goMyIssues", category: "navigation", defaultShortcut: null, allowInEditable: false },- { id: "goIssues", category: "navigation", defaultShortcut: null, allowInEditable: false },- { id: "goProjects", category: "navigation", defaultShortcut: null, allowInEditable: false },+ // G then a letter, as in Linear and GitHub. T is Issues (tasks): I is Inbox.+ { id: "goInbox", category: "navigation", defaultShortcut: go("I"), allowInEditable: false },+ { id: "goChat", category: "navigation", defaultShortcut: go("C"), allowInEditable: false },+ { id: "goMyIssues", category: "navigation", defaultShortcut: go("M"), allowInEditable: false },+ { id: "goIssues", category: "navigation", defaultShortcut: go("T"), allowInEditable: false },+ { id: "goProjects", category: "navigation", defaultShortcut: go("P"), allowInEditable: false },{ id: "goAutopilots", category: "navigation", defaultShortcut: null, allowInEditable: false },- { id: "goAgents", category: "navigation", defaultShortcut: null, allowInEditable: false },+ { id: "goAgents", category: "navigation", defaultShortcut: go("A"), allowInEditable: false },{ id: "goSquads", category: "navigation", defaultShortcut: null, allowInEditable: false },{ id: "goUsage", category: "navigation", defaultShortcut: null, allowInEditable: false },{ id: "goRuntimes", category: "navigation", defaultShortcut: null, allowInEditable: false },@@ -332,6 +357,9 @@ export function shortcutChordEquals(right: ShortcutChord | null,): boolean {if (left === null || right === null) return left === right;+ if (left.then || right.then) {+ if (!left.then || !right.then || !shortcutChordEquals(left.then, right.then)) return false;+ }return (left.key === right.key &&left.modifiers.primary === right.modifiers.primary &&@@ -342,6 +370,13 @@ export function shortcutChordEquals();}+/** The first key of a sequence, or the chord itself. */+export function shortcutFirstStep(shortcut: ShortcutChord): ShortcutChord {+ if (!shortcut.then) return shortcut;+ const { then: _then, ...first } = shortcut;+ return first;+}+/** Exact matcher: any additional modifier intentionally makes the event differ. */export function shortcutMatchesEvent(shortcut: ShortcutChord | null,@@ -353,7 +388,7 @@ export function shortcutMatchesEvent(// example pressing Command/Control/Shift by itself). Neither may execute an// action, even though `shortcutChordEquals(null, null)` is useful elsewhere// when comparing persisted values.- if (!shortcut) return false;+ if (!shortcut || shortcut.then) return false;const eventShortcut = shortcutFromEvent(event, platform);if (eventShortcut !== null && shortcutChordEquals(shortcut, eventShortcut)) {return true;@@ -376,6 +411,9 @@ export function formatShortcut(platform: ShortcutPlatform = getShortcutPlatform(),): string {if (!shortcut) return "—";+ if (shortcut.then) {+ return `${formatShortcut(shortcutFirstStep(shortcut), platform)} ${formatShortcut(shortcut.then, platform)}`;+ }const { modifiers } = shortcut;const keyLabels: Record<string, string> = {Enter: platform === "macos" ? "↵" : "Enter",@@ -426,6 +464,15 @@ export function isEditableShortcutTarget(target: EventTarget | null): boolean {);}+/**+ * A control recording a new shortcut (Settings › Shortcuts) marks itself with+ * `data-shortcut-recorder`: every key pressed there is the binding being+ * recorded, so no listener that runs before it may take one.+ */+export function isShortcutRecorderTarget(target: EventTarget | null): boolean {+ return target instanceof Element && target.closest("[data-shortcut-recorder]") !== null;+}+const PORTAL_LAYER_SELECTOR ='[role="menu"], [role="dialog"], [role="alertdialog"], [role="listbox"]';@@ -589,6 +636,7 @@ export function isShortcutAllowedForAction(platform: ShortcutPlatform = getShortcutPlatform(),runtime: ShortcutRuntime = getShortcutRuntime(),): boolean {+ if (shortcut.then) return isSequenceAllowedForAction(actionId, shortcut);if (!isShortcutChordActionable(shortcut)) return false;if (isReservedShortcut(shortcut, platform, runtime)) return false;// Tab is focus navigation (and Ctrl+Tab is browser tab navigation) on every@@ -615,6 +663,34 @@ export function isShortcutAllowedForAction(return hasModifier || !PLAIN_GLOBAL_RESERVED_KEYS.has(shortcut.key);}+/**+ * Whether `first` may start a sequence for `actionId`. A sequence starts with+ * a bare printable key (G) and goes on with another printable key, Shift+ * allowed. Both stay out of editors, so only actions that never run there may+ * take one, and among those only navigation, which `GlobalShortcuts` follows;+ * other actions are matched one event at a time.+ */+export function canStartShortcutSequence(actionId: ShortcutActionId, first: ShortcutChord): boolean {+ const action = SHORTCUT_ACTION_BY_ID[actionId];+ if (action.category !== "navigation" || action.allowInEditable) return false;+ return !first.then && isSequenceKey(first) && !hasShortcutModifier(first);+}++function isSequenceAllowedForAction(actionId: ShortcutActionId, shortcut: ShortcutChord): boolean {+ const then = shortcut.then!;+ return (+ canStartShortcutSequence(actionId, shortcutFirstStep(shortcut)) &&+ isSequenceKey(then) &&+ !then.then &&+ !hasCommandModifier(then) &&+ !then.modifiers.alt+ );+}++function isSequenceKey(shortcut: ShortcutChord): boolean {+ return isShortcutChordActionable(shortcut) && shortcut.key.length === 1 && shortcut.key !== " ";+}+/** One-time parser for v1 string preferences persisted before structured chords. */export function parseLegacyShortcut(value: string): ShortcutChord | null {if (!value) return null;diff --git a/packages/core/shortcuts/index.ts b/packages/core/shortcuts/index.tsindex ae3d757784..09e01bb1c2 100644--- a/packages/core/shortcuts/index.ts+++ b/packages/core/shortcuts/index.ts@@ -2,6 +2,9 @@ export {SHORTCUT_ACTIONS,SHORTCUT_ACTION_BY_ID,createShortcutChord,+ createShortcutSequence,+ canStartShortcutSequence,+ shortcutFirstStep,shortcutFromEvent,shortcutChordEquals,shortcutMatchesEvent,@@ -9,6 +12,7 @@ export {formatShortcut,isEditableShortcutTarget,isPortalLayerShortcutTarget,+ isShortcutRecorderTarget,isReservedShortcut,isShortcutAllowedForAction,isShortcutModifierKey,diff --git a/packages/core/shortcuts/store.test.ts b/packages/core/shortcuts/store.test.tsindex 223d9e75d0..a87972522a 100644--- a/packages/core/shortcuts/store.test.ts+++ b/packages/core/shortcuts/store.test.ts@@ -1,5 +1,5 @@import { afterEach, describe, expect, it } from "vitest";-import { createShortcutChord } from "./definitions";+import { createShortcutChord, createShortcutSequence } from "./definitions";import { configureShortcutPlatform, configureShortcutRuntime } from "./platform";import {findShortcutConflict,@@ -184,3 +184,26 @@ describe("shortcut store", () => {).toEqual({ overrides: { goInbox: null } });});});++describe("shortcut sequences in the store", () => {+ const seq = (first: string, then: string) => createShortcutSequence(first, createShortcutChord(then));++ it("keeps a stored sequence, and drops a malformed or longer one", () => {+ expect(sanitizeShortcutOverrides({ goSettings: seq("G", "S") })).toEqual({ goSettings: seq("G", "S") });+ expect(+ sanitizeShortcutOverrides({ goSettings: { ...createShortcutChord("G"), then: { key: "S" } } }),+ ).toEqual({});+ expect(+ sanitizeShortcutOverrides({ goSettings: createShortcutSequence("G", seq("S", "T")) }),+ ).toEqual({});+ expect(sanitizeShortcutOverrides({ createIssue: seq("G", "N") })).toEqual({});+ });++ it("takes a key that starts another action's sequence, and the other way round", () => {+ expect(findShortcutConflict("createIssue", createShortcutChord("G"))).toBe("goInbox");+ expect(findShortcutConflict("goSettings", seq("C", "S"))).toBe("createIssue");+ expect(findShortcutConflict("goSettings", seq("G", "I"))).toBe("goInbox");+ expect(findShortcutConflict("goSettings", seq("G", "S"))).toBeNull();+ expect(findShortcutConflict("goInbox", seq("G", "N"))).toBeNull();+ });+});diff --git a/packages/core/shortcuts/store.ts b/packages/core/shortcuts/store.tsindex d226362d41..b31023571f 100644--- a/packages/core/shortcuts/store.ts+++ b/packages/core/shortcuts/store.ts@@ -9,6 +9,7 @@ import {isShortcutAllowedForAction,parseLegacyShortcut,shortcutChordEquals,+ shortcutFirstStep,shortcutMatchesEvent,type ShortcutActionId,type ShortcutChord,@@ -24,7 +25,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {return value !== null && typeof value === "object" && !Array.isArray(value);}-function sanitizeShortcutChord(value: unknown): ShortcutChord | null | undefined {+function sanitizeShortcutChord(value: unknown, depth = 0): ShortcutChord | null | undefined {if (value === null) return null;if (!isRecord(value) || typeof value.key !== "string" || value.key.length === 0) {return undefined;@@ -41,7 +42,7 @@ function sanitizeShortcutChord(value: unknown): ShortcutChord | null | undefined) {return undefined;}- return {+ const chord: ShortcutChord = {key: value.key,modifiers: {primary,@@ -51,6 +52,13 @@ function sanitizeShortcutChord(value: unknown): ShortcutChord | null | undefinedshift,},};+ // A sequence has two steps, never more.+ if (value.then !== undefined) {+ const then = depth === 0 ? sanitizeShortcutChord(value.then, 1) : undefined;+ if (!then) return undefined;+ chord.then = then;+ }+ return chord;}/** Drop unknown actions and malformed chords instead of letting storage crash matching/UI. */@@ -170,6 +178,8 @@ export function getShortcut(actionId: ShortcutActionId): ShortcutChord | null {/*** Pass the recorded `event` so bindings stored in an older form that the same* keypress would also trigger (an Option chord saved as "©") count as taken.+ * A key that starts another action's sequence is taken too, and so is a+ * sequence whose first key is another action's: either would never fire.*/export function findShortcutConflict(actionId: ShortcutActionId,@@ -179,9 +189,12 @@ export function findShortcutConflict(for (const action of SHORTCUT_ACTIONS) {if (action.id === actionId) continue;const existing = getShortcut(action.id);+ if (!existing) continue;if (shortcutChordEquals(existing, shortcut) ||- (event !== undefined && shortcutMatchesEvent(existing, event))+ (event !== undefined && !shortcut.then && shortcutMatchesEvent(existing, event)) ||+ (!!existing.then !== !!shortcut.then &&+ shortcutChordEquals(shortcutFirstStep(existing), shortcutFirstStep(shortcut)))) {return action.id;}diff --git a/packages/views/common/shortcut-keycaps.test.tsx b/packages/views/common/shortcut-keycaps.test.tsxindex da2ea45d1f..2cd0ef299b 100644--- a/packages/views/common/shortcut-keycaps.test.tsx+++ b/packages/views/common/shortcut-keycaps.test.tsx@@ -1,6 +1,6 @@import { describe, expect, it } from "vitest";import { render, screen } from "@testing-library/react";-import { createShortcutChord } from "@multica/core/shortcuts";+import { createShortcutChord, createShortcutSequence } from "@multica/core/shortcuts";import { ShortcutKeycaps } from "./shortcut-keycaps";describe("ShortcutKeycaps", () => {@@ -102,4 +102,15 @@ describe("ShortcutKeycaps", () => {expect(screen.getByRole("img", { name: "Esc" })).toBeInTheDocument();expect(container.querySelector("[title='Esc']")).toHaveTextContent("Esc");});++ it("renders a sequence as one keycap per key, with an optional separator", () => {+ const sequence = createShortcutSequence("G", createShortcutChord("I"));+ const { container, rerender } = render(<ShortcutKeycaps shortcut={sequence} platform="macos" thenLabel="then" />);++ expect(screen.getByRole("img", { name: "G I" })).toHaveTextContent("GthenI");+ expect(container.querySelectorAll("[data-slot='kbd']")).toHaveLength(2);++ rerender(<ShortcutKeycaps shortcut={sequence} platform="macos" />);+ expect(screen.getByRole("img", { name: "G I" })).toHaveTextContent("GI");+ });});diff --git a/packages/views/common/shortcut-keycaps.tsx b/packages/views/common/shortcut-keycaps.tsxindex c96a21f735..28c7225e81 100644--- a/packages/views/common/shortcut-keycaps.tsx+++ b/packages/views/common/shortcut-keycaps.tsx@@ -3,6 +3,7 @@import {formatShortcut,getShortcutPlatform,+ shortcutFirstStep,useShortcut,type ShortcutActionId,type ShortcutChord,@@ -95,6 +96,7 @@ export function ShortcutKeycaps({size = "sm",layout = "pill",decorative = false,+ thenLabel,className,keyClassName,}: {@@ -109,10 +111,30 @@ export function ShortcutKeycaps({layout?: ShortcutKeycapsLayout;/** Hide a redundant hint when its parent already names the action. */decorative?: boolean;+ /** Shown between the keys of a sequence (G then I); without it they sit side by side. */+ thenLabel?: string;className?: string;keyClassName?: string;}) {const accessibleLabel = formatShortcut(shortcut, platform);++ if (shortcut.then) {+ const step = { platform, size, layout, decorative: true, keyClassName };+ return (+ <span+ className={cn("inline-flex items-center gap-1", className)}+ role={decorative ? undefined : "img"}+ aria-label={decorative ? undefined : accessibleLabel}+ aria-hidden={decorative || undefined}+ data-slot="shortcut-keycaps"+ data-sequence=""+ >+ <ShortcutKeycaps shortcut={shortcutFirstStep(shortcut)} {...step} />+ {thenLabel ? <span className="text-micro text-muted-foreground">{thenLabel}</span> : null}+ <ShortcutKeycaps shortcut={shortcut.then} {...step} />+ </span>+ );+ }const tokens = shortcutTokens(shortcut, platform);if (layout === "pill") {diff --git a/packages/views/layout/global-shortcuts.chat.test.tsx b/packages/views/layout/global-shortcuts.chat.test.tsxindex 3e5efe9e0b..11c5c5ac1e 100644--- a/packages/views/layout/global-shortcuts.chat.test.tsx+++ b/packages/views/layout/global-shortcuts.chat.test.tsx@@ -174,6 +174,16 @@ describe("chat toggle shortcut", () => {expect(h.chat.toggle).not.toHaveBeenCalled();});+ it("leaves both chat chords alone for a guest, who has no floating chat", () => {+ h.guest = true;+ render(<GlobalShortcuts />);++ expect(pressToggleChat()).toBe(false);+ expect(pressNewChat()).toBe(false);+ expect(h.chat.toggle).not.toHaveBeenCalled();+ expect(h.chat.startNewChat).not.toHaveBeenCalled();+ });+it("reads the preference at press time, not at mount", () => {render(<GlobalShortcuts />);diff --git a/packages/views/layout/global-shortcuts.sequence.test.tsx b/packages/views/layout/global-shortcuts.sequence.test.tsxnew file mode 100644index 0000000000..5d75b181fd--- /dev/null+++ b/packages/views/layout/global-shortcuts.sequence.test.tsx@@ -0,0 +1,224 @@+import { act, cleanup, render } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { useModalStore } from "@multica/core/modals";+import { configureShortcutPlatform, createShortcutChord, useShortcutStore } from "@multica/core/shortcuts";+import { NavigationProvider, type NavigationAdapter } from "../navigation";+import { GlobalShortcuts, SHORTCUT_SEQUENCE_TIMEOUT_MS } from "./global-shortcuts";++vi.mock("@multica/ui/components/ui/sidebar", () => ({+ useSidebar: () => ({ toggleSidebar: vi.fn() }),+}));+vi.mock("@multica/core/chat", () => ({+ useChatStore: { getState: () => ({ floatingChatEnabled: false }) },+}));+const viewer = vi.hoisted(() => ({ guest: false }));+vi.mock("@multica/core/permissions", () => ({ useIsGuest: () => viewer.guest }));+vi.mock("@multica/core/paths", () => ({+ useCurrentWorkspace: () => ({ id: "w" }),+ useWorkspacePaths: () => ({+ inbox: () => "/w/inbox",+ chat: () => "/w/chat",+ myIssues: () => "/w/my-issues",+ issues: () => "/w/issues",+ projects: () => "/w/projects",+ autopilots: () => "/w/autopilots",+ agents: () => "/w/agents",+ squads: () => "/w/squads",+ usage: () => "/w/usage",+ runtimes: () => "/w/runtimes",+ skills: () => "/w/skills",+ settings: () => "/w/settings",+ }),+}));++const adapter: NavigationAdapter = {+ push: vi.fn(),+ replace: vi.fn(),+ back: vi.fn(),+ pathname: "/w/issues",+ searchParams: new URLSearchParams(),+ hash: "",+ getShareableUrl: (path) => path,+};++function press(key: string, init: KeyboardEventInit = {}, target: EventTarget = document.body) {+ const event = new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true, ...init });+ target.dispatchEvent(event);+ return event;+}++describe("GlobalShortcuts sequences", () => {+ const pageKey = vi.fn();++ const renderShortcuts = () =>+ render(+ <NavigationProvider value={adapter}>+ <GlobalShortcuts />+ </NavigationProvider>,+ );++ beforeEach(() => {+ configureShortcutPlatform("macos");+ vi.clearAllMocks();+ viewer.guest = false;+ // A page's own single-key shortcut, as the issue verbs (P, A) listen.+ document.addEventListener("keydown", pageKey);+ renderShortcuts();+ });++ afterEach(() => {+ document.removeEventListener("keydown", pageKey);+ configureShortcutPlatform(null);+ vi.useRealTimers();+ act(() => {+ useShortcutStore.getState().resetAll();+ useModalStore.getState().close();+ });+ });++ it.each([+ ["I", "/w/inbox"],+ ["M", "/w/my-issues"],+ ["P", "/w/projects"],+ ["C", "/w/chat"],+ ["A", "/w/agents"],+ ])("goes somewhere on G then %s", (key, path) => {+ expect(press("g").defaultPrevented).toBe(true);+ expect(press(key.toLowerCase()).defaultPrevented).toBe(true);+ expect(adapter.push).toHaveBeenCalledWith(path);+ });++ it("takes G then T on the Issues page without going anywhere", () => {+ press("g");+ expect(press("t").defaultPrevented).toBe(true);+ expect(adapter.push).not.toHaveBeenCalled();+ });++ it("keeps the second key from the page's own shortcuts", () => {+ press("g");+ press("p");+ expect(pageKey).toHaveBeenCalledTimes(0);++ press("p");+ expect(pageKey).toHaveBeenCalledTimes(1);+ });++ it("lets any other second key through with its own meaning", () => {+ press("g");+ const event = press("j");+ expect(event.defaultPrevented).toBe(false);+ expect(pageKey).toHaveBeenCalledTimes(1);+ expect(adapter.push).not.toHaveBeenCalled();++ press("i");+ expect(adapter.push).not.toHaveBeenCalled();+ });++ it("waits for the second key only so long", () => {+ vi.useFakeTimers();+ press("g");+ vi.advanceTimersByTime(SHORTCUT_SEQUENCE_TIMEOUT_MS + 1);+ press("i");+ expect(adapter.push).not.toHaveBeenCalled();+ });++ it("waits through Shift on the way to a shifted second key", () => {+ act(() =>+ useShortcutStore+ .getState()+ .setShortcut("goSettings", { ...createShortcutChord("G"), then: createShortcutChord("S", { shift: true }) }),+ );+ press("g");+ press("Shift", { shiftKey: true });+ press("S", { shiftKey: true });+ expect(adapter.push).toHaveBeenCalledWith("/w/settings");+ });++ it("lets a field, a dialog or a modal focused after G keep the second key", () => {+ const input = document.createElement("input");+ document.body.appendChild(input);+ press("g");+ expect(press("i", {}, input).defaultPrevented).toBe(false);+ expect(pageKey).toHaveBeenCalledTimes(1);+ // The sequence ended there: the next key on the page is not its second.+ press("p");+ input.remove();++ const dialog = document.createElement("div");+ dialog.setAttribute("role", "dialog");+ document.body.appendChild(dialog);+ press("g");+ expect(press("m", {}, dialog).defaultPrevented).toBe(false);+ dialog.remove();++ press("g");+ act(() => useModalStore.getState().open("create-issue"));+ expect(press("t").defaultPrevented).toBe(false);+ expect(adapter.push).not.toHaveBeenCalled();+ });++ it("does not start in a field, a dialog or a modal", () => {+ const input = document.createElement("input");+ document.body.appendChild(input);+ expect(press("g", {}, input).defaultPrevented).toBe(false);+ press("i", {}, input);+ input.remove();++ const dialog = document.createElement("div");+ dialog.setAttribute("role", "dialog");+ document.body.appendChild(dialog);+ press("g", {}, dialog);+ press("i", {}, dialog);+ dialog.remove();++ act(() => useModalStore.getState().open("create-issue"));+ press("g");+ press("i");+ expect(adapter.push).not.toHaveBeenCalled();+ });++ it("leaves every key to a shortcut being recorded", () => {+ const recorder = document.createElement("button");+ recorder.setAttribute("data-shortcut-recorder", "");+ document.body.appendChild(recorder);+ expect(press("g", {}, recorder).defaultPrevented).toBe(false);+ expect(press("u", {}, recorder).defaultPrevented).toBe(false);+ expect(pageKey).toHaveBeenCalledTimes(2);++ press("g");+ press("i", {}, recorder);+ recorder.remove();+ expect(adapter.push).not.toHaveBeenCalled();+ });++ it("follows a rebound sequence, and the old one no longer", () => {+ act(() =>+ useShortcutStore.getState().setShortcut("goInbox", { ...createShortcutChord("G"), then: createShortcutChord("N") }),+ );+ press("g");+ press("i");+ expect(adapter.push).not.toHaveBeenCalled();+ press("g");+ press("n");+ expect(adapter.push).toHaveBeenCalledWith("/w/inbox");+ });++ it("leaves a guest's keys for pages it cannot open unclaimed", () => {+ cleanup();+ viewer.guest = true;+ renderShortcuts();+ press("g");+ expect(press("c").defaultPrevented).toBe(false);+ expect(adapter.push).not.toHaveBeenCalled();++ press("g");+ press("i");+ expect(adapter.push).toHaveBeenCalledWith("/w/inbox");+ });++ it("opens the shortcut sheet on ?", () => {+ const event = press("?", { shiftKey: true });+ expect(event.defaultPrevented).toBe(true);+ expect(useModalStore.getState().modal).toBe("keyboard-shortcuts");+ });+});diff --git a/packages/views/layout/global-shortcuts.tsx b/packages/views/layout/global-shortcuts.tsxindex cbebb89ccd..5158bd1fba 100644--- a/packages/views/layout/global-shortcuts.tsx+++ b/packages/views/layout/global-shortcuts.tsx@@ -5,10 +5,16 @@ import { useSidebar } from "@multica/ui/components/ui/sidebar";import {getShortcut,isEditableShortcutTarget,+ isPortalLayerShortcutTarget,+ isShortcutModifierKey,+ isShortcutRecorderTarget,+ shortcutChordEquals,+ shortcutFirstStep,shortcutMatchesEvent,SHORTCUT_ACTION_BY_ID,useShortcutStore,type ShortcutActionId,+ type ShortcutChord,} from "@multica/core/shortcuts";import { useChatStore } from "@multica/core/chat";import { useSearchStore } from "@multica/core/command-bar";@@ -27,6 +33,7 @@ const GLOBAL_ACTIONS: readonly ShortcutActionId[] = ["toggleSidebar","toggleChat","newChat",+ "showShortcuts","goBack","goForward","goInbox",@@ -47,13 +54,44 @@ export function shouldIgnoreGlobalShortcutEvent(event: KeyboardEvent): boolean {return event.defaultPrevented || event.repeat || isImeComposing(event);}+/**+ * What a guest (MUL-9420) cannot do from the keyboard: it has only the Work+ * pages (any other page sends it back to the Inbox) and edits no issue. Its+ * keys stay unclaimed, and the shortcut sheet leaves them out.+ */+const GUEST_UNAVAILABLE_ACTIONS = new Set<ShortcutActionId>([+ "createIssue",+ "toggleChat",+ "newChat",+ "goChat",+ "goAutopilots",+ "goAgents",+ "goSquads",+ "goUsage",+ "goRuntimes",+ "goSkills",+ "setIssueStatus",+ "assignIssue",+ "setIssuePriority",+ "setIssueLabels",+ "setIssueDueDate",+ "moveIssueToProject",+ "runIssueQuickAction",+]);++export function isShortcutActionAvailable(actionId: ShortcutActionId, guest: boolean): boolean {+ return !guest || !GUEST_UNAVAILABLE_ACTIONS.has(actionId);+}++/** How long the first key of a sequence (G) waits for the second. */+export const SHORTCUT_SEQUENCE_TIMEOUT_MS = 1500;+/** Executes configurable product-level shortcuts inside the dashboard shell. */export function GlobalShortcuts() {const { toggleSidebar } = useSidebar();const toggleNav = useAppShell()?.toggleNav ?? toggleSidebar;const navigation = useNavigation();const workspacePaths = useWorkspacePaths();- // A guest (MUL-9420) cannot create issues, so its `C` stays unclaimed.const guest = useIsGuest(useCurrentWorkspace()?.id);// Subscribe so changing a binding in Settings immediately refreshes the@@ -86,26 +124,7 @@ export function GlobalShortcuts() {useChatStore.getState().floatingChatEnabled &&!isFloatingChatRouteSuppressed(navigation.pathname, chatPath);- const handleKeyDown = (event: KeyboardEvent) => {- // Component/editor handlers run before this document-level listener.- // Respect their preventDefault instead of double-triggering a product- // action after the focused control already consumed the same chord.- if (shouldIgnoreGlobalShortcutEvent(event)) return;-- const actionId = GLOBAL_ACTIONS.find((candidate) => {- const action = SHORTCUT_ACTION_BY_ID[candidate];- if (!action.allowInEditable && isEditableShortcutTarget(event.target)) {- return false;- }- if ((candidate === "toggleChat" || candidate === "newChat") && !canUseFloatingChat()) {- return false;- }- if (candidate === "createIssue" && guest) return false;- return shortcutMatchesEvent(getShortcut(candidate), event);- });- if (!actionId) return;-- event.preventDefault();+ const run = (actionId: ShortcutActionId) => {if (actionId === "openSearch") {useSearchStore.getState().toggle();return;@@ -140,6 +159,11 @@ export function GlobalShortcuts() {openCreateIssueForPath(navigation.pathname);return;}+ if (actionId === "showShortcuts") {+ if (useModalStore.getState().modal) return;+ useModalStore.getState().open("keyboard-shortcuts");+ return;+ }const destination = destinations[actionId];if (destination && destination !== navigation.pathname) {@@ -147,8 +171,84 @@ export function GlobalShortcuts() {}};+ const handleKeyDown = (event: KeyboardEvent) => {+ // Component/editor handlers run before this document-level listener.+ // Respect their preventDefault instead of double-triggering a product+ // action after the focused control already consumed the same chord.+ if (shouldIgnoreGlobalShortcutEvent(event)) return;++ const actionId = GLOBAL_ACTIONS.find((candidate) => {+ const action = SHORTCUT_ACTION_BY_ID[candidate];+ if (!action.allowInEditable && isEditableShortcutTarget(event.target)) {+ return false;+ }+ if ((candidate === "toggleChat" || candidate === "newChat") && !canUseFloatingChat()) {+ return false;+ }+ if (!isShortcutActionAvailable(candidate, guest)) return false;+ return shortcutMatchesEvent(getShortcut(candidate), event);+ });+ if (!actionId) return;++ event.preventDefault();+ run(actionId);+ };++ // Sequences (G then I) are followed on the window, capturing: the second key+ // is often a page's own single-key shortcut (P is priority, C creates an+ // issue), and a pending sequence must take it before any of them.+ let pending: { first: ShortcutChord; timer: ReturnType<typeof setTimeout> } | null = null;+ const clearPending = () => {+ if (pending) clearTimeout(pending.timer);+ pending = null;+ };+ const sequences = () =>+ GLOBAL_ACTIONS.flatMap((id) => {+ if (!isShortcutActionAvailable(id, guest)) return [];+ const shortcut = getShortcut(id);+ return shortcut?.then ? [{ id, first: shortcutFirstStep(shortcut), then: shortcut.then }] : [];+ });++ const handleSequenceKey = (event: KeyboardEvent) => {+ if (shouldIgnoreGlobalShortcutEvent(event) || isShortcutModifierKey(event.key)) return;+ // A field, a menu, a dialog or a shortcut being recorded owns its keys,+ // even when the pointer took focus there between the two keys.+ if (+ isShortcutRecorderTarget(event.target) ||+ isEditableShortcutTarget(event.target) ||+ isPortalLayerShortcutTarget(event.target) ||+ useModalStore.getState().modal+ ) {+ clearPending();+ return;+ }+ if (pending) {+ const { first } = pending;+ clearPending();+ const match = sequences().find(+ (sequence) => shortcutChordEquals(sequence.first, first) && shortcutMatchesEvent(sequence.then, event),+ );+ // Any other key ends the sequence and keeps its own meaning.+ if (!match) return;+ event.preventDefault();+ event.stopImmediatePropagation();+ run(match.id);+ return;+ }+ const first = sequences().find((sequence) => shortcutMatchesEvent(sequence.first, event))?.first;+ if (!first) return;+ event.preventDefault();+ event.stopImmediatePropagation();+ pending = { first, timer: setTimeout(clearPending, SHORTCUT_SEQUENCE_TIMEOUT_MS) };+ };++ window.addEventListener("keydown", handleSequenceKey, true);document.addEventListener("keydown", handleKeyDown);- return () => document.removeEventListener("keydown", handleKeyDown);+ return () => {+ clearPending();+ window.removeEventListener("keydown", handleSequenceKey, true);+ document.removeEventListener("keydown", handleKeyDown);+ };}, [guest, navigation, overrides, toggleNav, workspacePaths]);return null;diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.jsonindex 51ca124658..b61aee6420 100644--- a/packages/views/locales/en/settings.json+++ b/packages/views/locales/en/settings.json@@ -386,6 +386,9 @@"record_aria": "Change shortcut for {{action}}","recording": "Press keys","record_hint": "Esc cancels · Delete clears",+ "record_sequence_hint": "Press a key, or two in a row for a sequence such as G then I · Esc cancels",+ "record_then_hint": "Press the second key · ↵ keeps one key · Backspace starts over",+ "then": "then","unassigned": "Unassigned","no_results": "No matching shortcut actions.","conflict_error": "Already used by {{action}}.",@@ -489,6 +492,10 @@"label": "Reply","description": "Focus the open issue's comment box."},+ "showShortcuts": {+ "label": "Show keyboard shortcuts",+ "description": "Open the list of shortcuts, with the current page's first."+ },"send": {"label": "Send","description": "Also submits new issues."@@ -565,6 +572,32 @@"zoom_out": "Zoom out","reset_zoom": "Reset zoom","close_dialog": "Close dialog or menu"+ },+ "cheatsheet": {+ "title": "Keyboard shortcuts",+ "current_page": "current page",+ "footer_prefix": "Shortcuts are saved on this device. Change them in ",+ "footer_link": "Settings › Shortcuts",+ "footer_suffix": ".",+ "groups": {+ "inbox": "Inbox",+ "issue": "Issue",+ "navigation": "Navigation",+ "general": "General",+ "list": "Lists and boards",+ "editor": "Editor"+ },+ "rows": {+ "list_move": "Move down / up",+ "list_columns": "Move across board columns",+ "list_open": "Open",+ "list_peek": "Preview",+ "list_select": "Select",+ "list_extend": "Extend selection",+ "list_select_all": "Select all",+ "list_clear": "Clear selection",+ "editor_leave": "Leave the field"+ }}},"chat": {diff --git a/packages/views/locales/es/settings.json b/packages/views/locales/es/settings.jsonindex 67b5d1edd1..48dc5faa05 100644--- a/packages/views/locales/es/settings.json+++ b/packages/views/locales/es/settings.json@@ -386,6 +386,9 @@"record_aria": "Cambiar atajo de {{action}}","recording": "Pulsa las teclas","record_hint": "Esc cancela · Supr borra",+ "record_sequence_hint": "Pulsa una tecla, o dos seguidas para una secuencia como G luego I · Esc cancela",+ "record_then_hint": "Pulsa la segunda tecla · ↵ deja una sola tecla · Retroceso empieza de nuevo",+ "then": "luego","unassigned": "Sin asignar","no_results": "Ninguna acción de atajo coincide.","conflict_error": "Ya lo usa {{action}}.",@@ -489,6 +492,10 @@"label": "Responder","description": "Enfoca el cuadro de comentarios de la tarea abierta."},+ "showShortcuts": {+ "label": "Mostrar atajos de teclado",+ "description": "Abre la lista de atajos, con los de la página actual primero."+ },"send": {"label": "Enviar","description": "También envía nuevas tareas."@@ -565,6 +572,32 @@"zoom_out": "Alejar","reset_zoom": "Restablecer zoom","close_dialog": "Cerrar diálogo o menú"+ },+ "cheatsheet": {+ "title": "Atajos de teclado",+ "current_page": "página actual",+ "footer_prefix": "Los atajos se guardan en este dispositivo. Cámbialos en ",+ "footer_link": "Configuración › Atajos",+ "footer_suffix": ".",+ "groups": {+ "inbox": "Bandeja de entrada",+ "issue": "Tarea",+ "navigation": "Navegación",+ "general": "General",+ "list": "Listas y tableros",+ "editor": "Editor"+ },+ "rows": {+ "list_move": "Bajar / subir",+ "list_columns": "Cambiar de columna del tablero",+ "list_open": "Abrir",+ "list_peek": "Vista previa",+ "list_select": "Seleccionar",+ "list_extend": "Ampliar la selección",+ "list_select_all": "Seleccionar todo",+ "list_clear": "Quitar la selección",+ "editor_leave": "Salir del campo"+ }}},"chat": {diff --git a/packages/views/locales/fr/settings.json b/packages/views/locales/fr/settings.jsonindex fbf8714b8d..4f4a2b1cba 100644--- a/packages/views/locales/fr/settings.json+++ b/packages/views/locales/fr/settings.json@@ -386,6 +386,9 @@"record_aria": "Modifier le raccourci de {{action}}","recording": "Appuyez sur les touches","record_hint": "Échap annule · Suppr efface",+ "record_sequence_hint": "Appuyez sur une touche, ou deux à la suite pour une séquence comme G puis I · Échap annule",+ "record_then_hint": "Appuyez sur la deuxième touche · ↵ garde une seule touche · Retour arrière recommence",+ "then": "puis","unassigned": "Non attribué","no_results": "Aucune action de raccourci correspondante.","conflict_error": "Déjà utilisé par {{action}}.",@@ -489,6 +492,10 @@"label": "Répondre","description": "Place le curseur dans la zone de commentaire de la tâche ouverte."},+ "showShortcuts": {+ "label": "Afficher les raccourcis clavier",+ "description": "Ouvre la liste des raccourcis, ceux de la page actuelle en premier."+ },"send": {"label": "Envoyer","description": "Permet aussi de créer des tâches."@@ -565,6 +572,32 @@"zoom_out": "Zoom arrière","reset_zoom": "Réinitialiser le zoom","close_dialog": "Fermer la fenêtre ou le menu"+ },+ "cheatsheet": {+ "title": "Raccourcis clavier",+ "current_page": "page actuelle",+ "footer_prefix": "Les raccourcis sont enregistrés sur cet appareil. Modifiez-les dans ",+ "footer_link": "Paramètres › Raccourcis",+ "footer_suffix": ".",+ "groups": {+ "inbox": "Boîte de réception",+ "issue": "Tâche",+ "navigation": "Navigation",+ "general": "Général",+ "list": "Listes et tableaux",+ "editor": "Éditeur"+ },+ "rows": {+ "list_move": "Descendre / monter",+ "list_columns": "Changer de colonne du tableau",+ "list_open": "Ouvrir",+ "list_peek": "Aperçu",+ "list_select": "Sélectionner",+ "list_extend": "Étendre la sélection",+ "list_select_all": "Tout sélectionner",+ "list_clear": "Effacer la sélection",+ "editor_leave": "Quitter le champ"+ }}},"chat": {diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.jsonindex ca6d790b81..5b09932669 100644--- a/packages/views/locales/ja/settings.json+++ b/packages/views/locales/ja/settings.json@@ -380,6 +380,9 @@"record_aria": "{{action}}のショートカットを変更","recording": "キーを入力","record_hint": "Esc でキャンセル · Delete でクリア",+ "record_sequence_hint": "キーを押すか、G → I のように 2 つ続けて押すとシーケンスになります · Esc でキャンセル",+ "record_then_hint": "2 つ目のキーを押す · ↵ で 1 キーのまま · Backspace でやり直し",+ "then": "→","unassigned": "未設定","no_results": "一致するショートカット操作はありません。","conflict_error": "すでに{{action}}で使用されています。",@@ -483,6 +486,10 @@"label": "返信","description": "開いているタスクのコメント欄にフォーカスします。"},+ "showShortcuts": {+ "label": "キーボードショートカットを表示",+ "description": "ショートカットの一覧を開きます。今のページのものが先頭です。"+ },"send": {"label": "送信","description": "新しいタスクの作成にも使えます。"@@ -559,6 +566,32 @@"zoom_out": "縮小","reset_zoom": "ズームをリセット","close_dialog": "ダイアログまたはメニューを閉じる"+ },+ "cheatsheet": {+ "title": "キーボードショートカット",+ "current_page": "現在のページ",+ "footer_prefix": "ショートカットはこのデバイスに保存されます。変更は ",+ "footer_link": "設定 › ショートカット",+ "footer_suffix": " から。",+ "groups": {+ "inbox": "受信箱",+ "issue": "タスク",+ "navigation": "ナビゲーション",+ "general": "一般",+ "list": "リストとボード",+ "editor": "エディター"+ },+ "rows": {+ "list_move": "下 / 上へ移動",+ "list_columns": "ボードの列を移動",+ "list_open": "開く",+ "list_peek": "プレビュー",+ "list_select": "選択",+ "list_extend": "選択を広げる",+ "list_select_all": "すべて選択",+ "list_clear": "選択を解除",+ "editor_leave": "入力欄から出る"+ }}},"chat": {diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.jsonindex 151e0bc9e5..aa9595fd65 100644--- a/packages/views/locales/ko/settings.json+++ b/packages/views/locales/ko/settings.json@@ -380,6 +380,9 @@"record_aria": "{{action}} 단축키 변경","recording": "키를 누르세요","record_hint": "Esc 취소 · Delete 지우기",+ "record_sequence_hint": "키를 누르거나, G 다음 I처럼 두 키를 이어서 누르면 시퀀스가 됩니다 · Esc 취소",+ "record_then_hint": "두 번째 키를 누르세요 · ↵ 한 키만 사용 · Backspace 다시 시작",+ "then": "다음","unassigned": "지정되지 않음","no_results": "일치하는 단축키 동작이 없습니다.","conflict_error": "이미 {{action}}에서 사용 중입니다.",@@ -483,6 +486,10 @@"label": "답글","description": "열린 태스크의 댓글 입력란에 포커스합니다."},+ "showShortcuts": {+ "label": "키보드 단축키 보기",+ "description": "단축키 목록을 엽니다. 현재 페이지의 단축키가 먼저 나옵니다."+ },"send": {"label": "보내기","description": "새 태스크 생성에도 사용됩니다."@@ -559,6 +566,32 @@"zoom_out": "축소","reset_zoom": "확대/축소 재설정","close_dialog": "대화상자 또는 메뉴 닫기"+ },+ "cheatsheet": {+ "title": "키보드 단축키",+ "current_page": "현재 페이지",+ "footer_prefix": "단축키는 이 기기에 저장됩니다. ",+ "footer_link": "설정 › 단축키",+ "footer_suffix": "에서 바꿀 수 있습니다.",+ "groups": {+ "inbox": "받은편지함",+ "issue": "태스크",+ "navigation": "탐색",+ "general": "일반",+ "list": "목록과 보드",+ "editor": "편집기"+ },+ "rows": {+ "list_move": "아래 / 위로 이동",+ "list_columns": "보드 열 이동",+ "list_open": "열기",+ "list_peek": "미리보기",+ "list_select": "선택",+ "list_extend": "선택 확장",+ "list_select_all": "모두 선택",+ "list_clear": "선택 해제",+ "editor_leave": "입력란에서 나가기"+ }}},"chat": {diff --git a/packages/views/locales/ru/settings.json b/packages/views/locales/ru/settings.jsonindex dcb8f47d8c..1937da6567 100644--- a/packages/views/locales/ru/settings.json+++ b/packages/views/locales/ru/settings.json@@ -398,6 +398,9 @@"record_aria": "Изменить сочетание клавиш для {{action}}","recording": "Нажмите клавиши","record_hint": "Esc — отмена · Delete — очистить",+ "record_sequence_hint": "Нажмите клавишу или две подряд для последовательности, например G затем I · Esc — отмена",+ "record_then_hint": "Нажмите вторую клавишу · ↵ — оставить одну · Backspace — начать заново",+ "then": "затем","unassigned": "Не назначено","no_results": "Нет подходящих действий.","conflict_error": "Уже используется для «{{action}}».",@@ -501,6 +504,10 @@"label": "Ответить","description": "Перевести фокус в поле комментария открытой задачи."},+ "showShortcuts": {+ "label": "Показать горячие клавиши",+ "description": "Открывает список горячих клавиш, сначала для текущей страницы."+ },"send": {"label": "Отправить","description": "Также отправляет новые задачи."@@ -577,6 +584,32 @@"zoom_out": "Уменьшить масштаб","reset_zoom": "Сбросить масштаб","close_dialog": "Закрыть диалог или меню"+ },+ "cheatsheet": {+ "title": "Горячие клавиши",+ "current_page": "текущая страница",+ "footer_prefix": "Горячие клавиши хранятся на этом устройстве. Изменить их можно в разделе ",+ "footer_link": "Настройки › Горячие клавиши",+ "footer_suffix": ".",+ "groups": {+ "inbox": "Входящие",+ "issue": "Задача",+ "navigation": "Навигация",+ "general": "Общие",+ "list": "Списки и доски",+ "editor": "Редактор"+ },+ "rows": {+ "list_move": "Вниз / вверх",+ "list_columns": "Между колонками доски",+ "list_open": "Открыть",+ "list_peek": "Предпросмотр",+ "list_select": "Выбрать",+ "list_extend": "Расширить выделение",+ "list_select_all": "Выбрать все",+ "list_clear": "Снять выделение",+ "editor_leave": "Выйти из поля"+ }}},"chat": {diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.jsonindex f0ab1afc12..7e4ef33a92 100644--- a/packages/views/locales/zh-Hans/settings.json+++ b/packages/views/locales/zh-Hans/settings.json@@ -380,6 +380,9 @@"record_aria": "修改\"{{action}}\"的快捷键","recording": "请按键","record_hint": "Esc 取消 · Delete 清除",+ "record_sequence_hint": "按一个键;连按两个键可设为序列,如 G 然后 I · Esc 取消",+ "record_then_hint": "按第二个键 · ↵ 只用一个键 · Backspace 重来",+ "then": "然后","unassigned": "未设置","no_results": "没有匹配的快捷键操作。","conflict_error": "已被\"{{action}}\"使用。",@@ -483,6 +486,10 @@"label": "回复","description": "聚焦当前任务的评论框。"},+ "showShortcuts": {+ "label": "显示快捷键",+ "description": "打开快捷键列表,当前页面相关的排在前面。"+ },"send": {"label": "发送","description": "也用于提交新任务。"@@ -559,6 +566,32 @@"zoom_out": "缩小","reset_zoom": "重置缩放","close_dialog": "关闭对话框或菜单"+ },+ "cheatsheet": {+ "title": "快捷键",+ "current_page": "当前页面",+ "footer_prefix": "快捷键仅保存在本设备,可在 ",+ "footer_link": "设置 › 快捷键",+ "footer_suffix": " 中修改。",+ "groups": {+ "inbox": "收件箱",+ "issue": "任务",+ "navigation": "导航",+ "general": "常规",+ "list": "列表与看板",+ "editor": "编辑器"+ },+ "rows": {+ "list_move": "下移 / 上移",+ "list_columns": "在看板列之间移动",+ "list_open": "打开",+ "list_peek": "预览",+ "list_select": "选中",+ "list_extend": "扩展选择",+ "list_select_all": "全选",+ "list_clear": "取消选择",+ "editor_leave": "离开输入框"+ }}},"chat": {diff --git a/packages/views/locales/zh-Hant/settings.json b/packages/views/locales/zh-Hant/settings.jsonindex e67e1ddd6a..ed0a9d7ece 100644--- a/packages/views/locales/zh-Hant/settings.json+++ b/packages/views/locales/zh-Hant/settings.json@@ -380,6 +380,9 @@"record_aria": "修改\"{{action}}\"的快捷鍵","recording": "請按鍵","record_hint": "Esc 取消 · Delete 清除",+ "record_sequence_hint": "按一個鍵;連按兩個鍵可設為序列,如 G 然後 I · Esc 取消",+ "record_then_hint": "按第二個鍵 · ↵ 只用一個鍵 · Backspace 重來",+ "then": "然後","unassigned": "未設定","no_results": "沒有匹配的快捷鍵操作。","conflict_error": "已被\"{{action}}\"使用。",@@ -483,6 +486,10 @@"label": "回覆","description": "聚焦目前任務的留言框。"},+ "showShortcuts": {+ "label": "顯示快捷鍵",+ "description": "開啟快捷鍵列表,目前頁面相關的排在前面。"+ },"send": {"label": "傳送","description": "也用於提交新任務。"@@ -559,6 +566,32 @@"zoom_out": "縮小","reset_zoom": "重置縮放","close_dialog": "關閉對話方塊或選單"+ },+ "cheatsheet": {+ "title": "快捷鍵",+ "current_page": "目前頁面",+ "footer_prefix": "快捷鍵僅儲存在本裝置,可在 ",+ "footer_link": "設定 › 快捷鍵",+ "footer_suffix": " 中修改。",+ "groups": {+ "inbox": "收件匣",+ "issue": "任務",+ "navigation": "導航",+ "general": "常規",+ "list": "列表與看板",+ "editor": "編輯器"+ },+ "rows": {+ "list_move": "下移 / 上移",+ "list_columns": "在看板欄之間移動",+ "list_open": "開啟",+ "list_peek": "預覽",+ "list_select": "選取",+ "list_extend": "擴展選取",+ "list_select_all": "全選",+ "list_clear": "取消選取",+ "editor_leave": "離開輸入框"+ }}},"chat": {diff --git a/packages/views/modals/keyboard-shortcuts.test.tsx b/packages/views/modals/keyboard-shortcuts.test.tsxnew file mode 100644index 0000000000..b46678abb6--- /dev/null+++ b/packages/views/modals/keyboard-shortcuts.test.tsx@@ -0,0 +1,128 @@+import { act, fireEvent, screen, within } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { configureShortcutPlatform, createShortcutChord, useShortcutStore } from "@multica/core/shortcuts";+import { renderWithI18n } from "../test/i18n";+import { NavigationProvider, type NavigationAdapter } from "../navigation";+import { KeyboardShortcutsModal } from "./keyboard-shortcuts";++vi.mock("@multica/core/paths", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@multica/core/paths")>()),+ useCurrentWorkspace: () => ({ id: "w" }),+ useWorkspacePaths: () => ({+ inbox: () => "/w/inbox",+ issues: () => "/w/issues",+ myIssues: () => "/w/my-issues",+ views: () => "/w/views",+ projects: () => "/w/projects",+ settings: () => "/w/settings",+ }),+}));++const viewer = vi.hoisted(() => ({ guest: false }));+vi.mock("@multica/core/permissions", () => ({ useIsGuest: () => viewer.guest }));++const onClose = vi.fn();++function renderSheet(pathname: string) {+ const adapter: NavigationAdapter = {+ push: vi.fn(),+ replace: vi.fn(),+ back: vi.fn(),+ pathname,+ searchParams: new URLSearchParams(),+ hash: "",+ getShareableUrl: (path) => path,+ };+ renderWithI18n(+ <NavigationProvider value={adapter}>+ <KeyboardShortcutsModal onClose={onClose} />+ </NavigationProvider>,+ );+ return adapter;+}++const headings = () => screen.getAllByRole("heading", { level: 3 }).map((heading) => heading.textContent);+const group = (name: string) => screen.getByRole("region", { name: new RegExp(`^${name}`) });++describe("KeyboardShortcutsModal", () => {+ beforeEach(() => {+ configureShortcutPlatform("macos");+ onClose.mockClear();+ viewer.guest = false;+ });++ afterEach(() => {+ configureShortcutPlatform(null);+ act(() => useShortcutStore.getState().resetAll());+ });++ it("leads with the Inbox and issue keys on the Inbox", () => {+ renderSheet("/w/inbox");+ expect(headings()).toEqual([+ "Inbox · current page",+ "Issue · current page",+ "Navigation",+ "General",+ "Lists and boards",+ "Editor",+ ]);+ });++ it("leads with the list keys on an issue list", () => {+ renderSheet("/w/projects/p-1");+ expect(headings().slice(0, 2)).toEqual(["Lists and boards · current page", "Issue · current page"]);+ });++ it("marks nothing as current elsewhere", () => {+ renderSheet("/w/agents");+ expect(headings()[0]).toBe("Inbox");+ });++ it("shows each binding as it is set, sequences included, and leaves out unbound actions", () => {+ act(() => useShortcutStore.getState().setShortcut("createIssue", createShortcutChord("N")));+ renderSheet("/w/agents");++ const navigation = group("Navigation");+ expect(within(navigation).getByRole("img", { name: "G I" })).toBeInTheDocument();+ expect(within(navigation).getAllByText("then").length).toBeGreaterThan(0);+ expect(within(navigation).queryByText("Go to Autopilot")).not.toBeInTheDocument();+ expect(within(group("General")).getByRole("img", { name: "N" })).toBeInTheDocument();+ expect(within(group("Editor")).queryByText("Voice input")).not.toBeInTheDocument();+ });++ it("leaves out what a guest cannot do", () => {+ viewer.guest = true;+ renderSheet("/w/inbox");+ expect(screen.queryByText("Go to Chat")).not.toBeInTheDocument();+ expect(screen.queryByText("Create issue")).not.toBeInTheDocument();+ expect(screen.queryByText("Change status")).not.toBeInTheDocument();+ expect(screen.queryByText("Toggle chat window")).not.toBeInTheDocument();+ expect(screen.queryByText("Ask Multica")).not.toBeInTheDocument();+ expect(screen.getByText("Go to Inbox")).toBeInTheDocument();+ expect(screen.getByText("Reply")).toBeInTheDocument();+ });++ it("lists the fixed list keys", () => {+ renderSheet("/w/issues");+ const list = group("Lists and boards");+ expect(within(list).getByText("Select")).toBeInTheDocument();+ expect(within(list).getByRole("img", { name: "X" })).toBeInTheDocument();+ expect(within(list).getByRole("img", { name: "⌘A" })).toBeInTheDocument();+ });++ it("filters by name", () => {+ renderSheet("/w/inbox");+ fireEvent.change(screen.getByRole("textbox", { name: "Search actions..." }), { target: { value: "status" } });+ expect(headings()).toEqual(["Issue · current page"]);++ fireEvent.change(screen.getByRole("textbox", { name: "Search actions..." }), { target: { value: "zzz" } });+ expect(screen.getByText("No matching shortcut actions.")).toBeInTheDocument();+ });++ it("links to the Shortcuts settings, closing the sheet", () => {+ const adapter = renderSheet("/w/inbox");+ fireEvent.click(screen.getByRole("link", { name: "Settings › Shortcuts" }));+ expect(onClose).toHaveBeenCalled();+ expect(adapter.push).toHaveBeenCalledWith("/w/settings?tab=shortcuts");+ });+});diff --git a/packages/views/modals/keyboard-shortcuts.tsx b/packages/views/modals/keyboard-shortcuts.tsxnew file mode 100644index 0000000000..0ff1f60d31--- /dev/null+++ b/packages/views/modals/keyboard-shortcuts.tsx@@ -0,0 +1,240 @@+"use client";++import { useMemo, useState } from "react";+import { Keyboard, Search } from "@multica/ui/icons";+import { Dialog, DialogContent, DialogTitle } from "@multica/ui/components/ui/dialog";+import { Input } from "@multica/ui/components/ui/input";+import { useCurrentWorkspace, useWorkspacePaths } from "@multica/core/paths";+import { useIsGuest } from "@multica/core/permissions";+import {+ createShortcutChord,+ resolveShortcut,+ useShortcutStore,+ type ShortcutActionId,+ type ShortcutChord,+} from "@multica/core/shortcuts";+import { useT } from "../i18n";+import { AppLink, useNavigation } from "../navigation";+import { ShortcutKeycaps } from "../common/shortcut-keycaps";+import { isShortcutActionAvailable } from "../layout/global-shortcuts";++type GroupId = "inbox" | "issue" | "navigation" | "general" | "list" | "editor";+type FixedRowId =+ | "list_move"+ | "list_columns"+ | "list_open"+ | "list_peek"+ | "list_select"+ | "list_extend"+ | "list_select_all"+ | "list_clear"+ | "editor_leave";++type Row =+ | { kind: "action"; id: ShortcutActionId }+ | { kind: "fixed"; id: FixedRowId; shortcuts: readonly ShortcutChord[] };++const action = (id: ShortcutActionId): Row => ({ kind: "action", id });+const fixed = (id: FixedRowId, ...shortcuts: ShortcutChord[]): Row => ({ kind: "fixed", id, shortcuts });+const key = createShortcutChord;++/**+ * What the sheet lists, in its default order. Bindings come from the registry+ * (so a rebound key shows as rebound, and an unbound action is left out);+ * the list and editor keys are fixed and listed as such.+ */+const GROUPS: readonly { id: GroupId; rows: readonly Row[] }[] = [+ {+ id: "inbox",+ rows: [+ action("archiveInboxItem"),+ action("unsubscribeArchiveInboxItem"),+ action("snoozeInboxItem"),+ action("markInboxUnread"),+ action("nextInboxItem"),+ action("prevInboxItem"),+ action("undoInboxAction"),+ ],+ },+ {+ id: "issue",+ rows: [+ action("setIssueStatus"),+ action("assignIssue"),+ action("setIssuePriority"),+ action("setIssueLabels"),+ action("setIssueDueDate"),+ action("moveIssueToProject"),+ action("runIssueQuickAction"),+ action("replyToIssue"),+ ],+ },+ {+ id: "navigation",+ rows: [+ action("goInbox"),+ action("goMyIssues"),+ action("goIssues"),+ action("goProjects"),+ action("goChat"),+ action("goAgents"),+ action("goAutopilots"),+ action("goSquads"),+ action("goUsage"),+ action("goRuntimes"),+ action("goSkills"),+ action("goSettings"),+ action("goBack"),+ action("goForward"),+ ],+ },+ {+ id: "general",+ rows: [+ action("openSearch"),+ action("createIssue"),+ action("showShortcuts"),+ action("toggleSidebar"),+ action("toggleRightSidebar"),+ action("toggleChat"),+ action("newChat"),+ ],+ },+ {+ id: "list",+ rows: [+ fixed("list_move", key("J"), key("K")),+ fixed("list_columns", key("Left"), key("Right")),+ fixed("list_open", key("Enter")),+ fixed("list_peek", key("Space")),+ fixed("list_select", key("X")),+ fixed("list_extend", key("Up", { shift: true }), key("Down", { shift: true })),+ fixed("list_select_all", key("A", { primary: true })),+ fixed("list_clear", key("Escape")),+ ],+ },+ {+ id: "editor",+ rows: [action("send"), fixed("editor_leave", key("Escape")), action("findInIssue"), action("voiceInput")],+ },+];++/** The groups the current page uses, most specific first. */+function useCurrentGroups(): ReadonlySet<GroupId> {+ const { pathname } = useNavigation();+ const p = useWorkspacePaths();+ return useMemo(() => {+ const under = (path: string) => pathname === path || pathname.startsWith(`${path}/`);+ if (under(p.inbox())) return new Set<GroupId>(["inbox", "issue"]);+ if (pathname.startsWith(`${p.issues()}/`)) return new Set<GroupId>(["issue"]);+ if (pathname === p.issues() || under(p.myIssues()) || under(p.views()) || pathname.startsWith(`${p.projects()}/`)) {+ return new Set<GroupId>(["list", "issue"]);+ }+ return new Set<GroupId>();+ }, [p, pathname]);+}++export function KeyboardShortcutsModal({+ open = true,+ onClose,+ onOpenChangeComplete,+}: {+ open?: boolean;+ onClose: () => void;+ onOpenChangeComplete?: (open: boolean) => void;+}) {+ const { t } = useT("settings");+ const [query, setQuery] = useState("");+ const overrides = useShortcutStore((state) => state.overrides);+ const current = useCurrentGroups();+ const p = useWorkspacePaths();+ const guest = useIsGuest(useCurrentWorkspace()?.id);++ const groups = useMemo(() => {+ const labelOf = (row: Row) =>+ row.kind === "action"+ ? t(($) => $.shortcuts.actions[row.id].label)+ : t(($) => $.shortcuts.cheatsheet.rows[row.id]);+ const needle = query.trim().toLocaleLowerCase();+ const ordered = [+ ...[...current].flatMap((id) => GROUPS.filter((group) => group.id === id)),+ ...GROUPS.filter((group) => !current.has(group.id)),+ ];+ return ordered+ .map((group) => ({+ id: group.id,+ rows: group.rows.flatMap((row) => {+ if (row.kind === "action" && !isShortcutActionAvailable(row.id, guest)) return [];+ const shortcuts =+ row.kind === "action" ? [resolveShortcut(overrides, row.id)].filter((s) => s !== null) : row.shortcuts;+ if (shortcuts.length === 0) return [];+ const label = labelOf(row);+ if (needle && !label.toLocaleLowerCase().includes(needle)) return [];+ return [{ id: row.id, label, shortcuts }];+ }),+ }))+ .filter((group) => group.rows.length > 0);+ }, [current, guest, overrides, query, t]);++ const then = t(($) => $.shortcuts.then);++ return (+ <Dialog open={open} onOpenChange={(next) => !next && onClose()} onOpenChangeComplete={onOpenChangeComplete}>+ <DialogContent className="flex max-h-[min(40rem,85%)] flex-col gap-0 overflow-hidden p-0 sm:max-w-4xl">+ <div className="flex shrink-0 items-center gap-4 border-b px-5 py-3 pr-12">+ <DialogTitle className="flex-1">{t(($) => $.shortcuts.cheatsheet.title)}</DialogTitle>+ <div className="relative w-56">+ <Search className="pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" />+ <Input+ value={query}+ onChange={(event) => setQuery(event.target.value)}+ placeholder={t(($) => $.shortcuts.search_placeholder)}+ aria-label={t(($) => $.shortcuts.search_placeholder)}+ className="h-8 pl-8"+ />+ </div>+ </div>+ <div className="min-h-0 flex-1 overflow-y-auto px-5 py-4">+ {groups.length === 0 ? (+ <p className="py-10 text-center text-body text-muted-foreground">{t(($) => $.shortcuts.no_results)}</p>+ ) : (+ <div className="grid gap-x-8 gap-y-6 sm:grid-cols-2 lg:grid-cols-3">+ {groups.map((group) => (+ <section key={group.id} aria-labelledby={`shortcuts-group-${group.id}`}>+ <h3 id={`shortcuts-group-${group.id}`} className="mb-1.5 text-caption font-medium text-muted-foreground">+ {t(($) => $.shortcuts.cheatsheet.groups[group.id])}+ {current.has(group.id) ? (+ <span className="font-normal"> · {t(($) => $.shortcuts.cheatsheet.current_page)}</span>+ ) : null}+ </h3>+ <ul>+ {group.rows.map((row) => (+ <li key={row.id} className="flex min-h-8 items-center justify-between gap-3 text-body">+ <span className="min-w-0 truncate">{row.label}</span>+ <span className="flex shrink-0 items-center gap-1">+ {row.shortcuts.map((shortcut, index) => (+ <ShortcutKeycaps key={index} shortcut={shortcut} thenLabel={then} />+ ))}+ </span>+ </li>+ ))}+ </ul>+ </section>+ ))}+ </div>+ )}+ </div>+ <div className="flex shrink-0 items-center gap-2 border-t px-5 py-3 text-caption text-muted-foreground">+ <Keyboard className="size-3.5 shrink-0" />+ <span>+ {t(($) => $.shortcuts.cheatsheet.footer_prefix)}+ <AppLink href={`${p.settings()}?tab=shortcuts`} className="text-brand hover:underline" onClick={onClose}>+ {t(($) => $.shortcuts.cheatsheet.footer_link)}+ </AppLink>+ {t(($) => $.shortcuts.cheatsheet.footer_suffix)}+ </span>+ </div>+ </DialogContent>+ </Dialog>+ );+}diff --git a/packages/views/modals/registry.tsx b/packages/views/modals/registry.tsxindex 4f0b07fde0..b0bafa0707 100644--- a/packages/views/modals/registry.tsx+++ b/packages/views/modals/registry.tsx@@ -6,6 +6,7 @@ import { CreateIssueDialog } from "./create-issue-dialog";import { CreateProjectModal } from "./create-project";import { CreateSquadModal } from "./create-squad";import { FeedbackModal } from "./feedback";+import { KeyboardShortcutsModal } from "./keyboard-shortcuts";import { SetParentIssueModal } from "./set-parent-issue";import { MarkDuplicateIssueModal } from "./mark-duplicate-issue";import { AddChildIssueModal } from "./add-child-issue";@@ -141,6 +142,16 @@ export function ModalRegistry() {/>);break;+ case "keyboard-shortcuts":+ activeModal = (+ <KeyboardShortcutsModal+ key={sessionKey}+ open={isOpen}+ onClose={close}+ onOpenChangeComplete={handleOpenChangeComplete}+ />+ );+ break;case "issue-set-parent":activeModal = (<SetParentIssueModaldiff --git a/packages/views/settings/components/keyboard-shortcuts-tab.test.tsx b/packages/views/settings/components/keyboard-shortcuts-tab.test.tsxindex 86b784f2c0..029fd21310 100644--- a/packages/views/settings/components/keyboard-shortcuts-tab.test.tsx+++ b/packages/views/settings/components/keyboard-shortcuts-tab.test.tsx@@ -281,4 +281,82 @@ describe("KeyboardShortcutsTab", () => {createShortcutChord("K", { primary: true }),);});++ describe("sequences", () => {+ const sequence = (first: string, then: string) => ({+ ...createShortcutChord(first),+ then: createShortcutChord(then),+ });+ const recorderFor = (action: string) =>+ screen.getByRole("button", { name: `Change shortcut for ${action}` });++ it("shows the default G then I with its separator", () => {+ renderWithI18n(<KeyboardShortcutsTab />);+ expect(within(recorderFor("Go to Inbox")).getByText("then")).toBeInTheDocument();+ expect(getShortcut("goInbox")).toEqual(sequence("G", "I"));+ });++ it("records a navigation action's two keys one after the other", () => {+ renderWithI18n(<KeyboardShortcutsTab />);+ const recorder = recorderFor("Go to Autopilot");+ expect(recorder).not.toHaveAttribute("data-shortcut-recorder");+ fireEvent.click(recorder);+ expect(recorder).toHaveAttribute("data-shortcut-recorder");+ fireEvent.keyDown(recorder, { key: "g" });++ expect(getShortcut("goAutopilots")).toBeNull();+ expect(recorder).toHaveTextContent("then…");+ expect(screen.getByText(/Press the second key/)).toBeInTheDocument();++ fireEvent.keyDown(recorder, { key: "u" });+ expect(getShortcut("goAutopilots")).toEqual(sequence("G", "U"));+ });++ it("keeps the first key alone on Enter, and starts over on Backspace", () => {+ renderWithI18n(<KeyboardShortcutsTab />);+ const recorder = recorderFor("Go to Autopilot");+ fireEvent.click(recorder);+ fireEvent.keyDown(recorder, { key: "o" });+ fireEvent.keyDown(recorder, { key: "Backspace" });+ expect(recorder).toHaveTextContent("Press keys");++ fireEvent.keyDown(recorder, { key: "o" });+ fireEvent.keyDown(recorder, { key: "Enter" });+ expect(getShortcut("goAutopilots")).toEqual(createShortcutChord("O"));+ });++ it("refuses a key that starts another action's sequence, and a sequence after another's key", () => {+ renderWithI18n(<KeyboardShortcutsTab />);+ const recorder = recorderFor("Create issue");+ fireEvent.click(recorder);+ fireEvent.keyDown(recorder, { key: "g" });+ expect(screen.getByRole("alert")).toHaveTextContent("Already used by Go to Inbox.");+ expect(getShortcut("createIssue")).toEqual(createShortcutChord("C"));+ fireEvent.keyDown(recorder, { key: "Escape" });++ const autopilot = recorderFor("Go to Autopilot");+ fireEvent.click(autopilot);+ fireEvent.keyDown(autopilot, { key: "c" });+ fireEvent.keyDown(autopilot, { key: "x" });+ expect(screen.getByRole("alert")).toHaveTextContent("Already used by Create issue.");+ expect(getShortcut("goAutopilots")).toBeNull();+ });++ it("refuses a sequence that is already taken", () => {+ renderWithI18n(<KeyboardShortcutsTab />);+ const recorder = recorderFor("Go to Autopilot");+ fireEvent.click(recorder);+ fireEvent.keyDown(recorder, { key: "g" });+ fireEvent.keyDown(recorder, { key: "i" });+ expect(screen.getByRole("alert")).toHaveTextContent("Already used by Go to Inbox.");+ });++ it("records other actions' single keys at once", () => {+ renderWithI18n(<KeyboardShortcutsTab />);+ const recorder = recorderFor("Create issue");+ fireEvent.click(recorder);+ fireEvent.keyDown(recorder, { key: "n" });+ expect(getShortcut("createIssue")).toEqual(createShortcutChord("N"));+ });+ });});diff --git a/packages/views/settings/components/keyboard-shortcuts-tab.tsx b/packages/views/settings/components/keyboard-shortcuts-tab.tsxindex 46c277b76f..ea4b0362da 100644--- a/packages/views/settings/components/keyboard-shortcuts-tab.tsx+++ b/packages/views/settings/components/keyboard-shortcuts-tab.tsx@@ -17,6 +17,7 @@ import {} from "@multica/ui/components/ui/alert-dialog";import { cn } from "@multica/ui/lib/utils";import {+ canStartShortcutSequence,findShortcutConflict,createShortcutChord,isReservedShortcut,@@ -24,6 +25,7 @@ import {isShortcutModifierKey,isPlainShortcut,resolveShortcut,+ shortcutFirstStep,shortcutFromEvent,SHORTCUT_ACTIONS,useShortcutStore,@@ -54,6 +56,8 @@ export function KeyboardShortcutsTab() {const { t } = useT("settings");const [query, setQuery] = useState("");const [recording, setRecording] = useState<ShortcutActionId | null>(null);+ // The first key of a sequence being recorded, waiting for the second.+ const [pendingFirst, setPendingFirst] = useState<ShortcutChord | null>(null);const [captureError, setCaptureError] = useState<CaptureError>(null);const [resetConfirmOpen, setResetConfirmOpen] = useState(false);const overrides = useShortcutStore((state) => state.overrides);@@ -77,19 +81,44 @@ export function KeyboardShortcutsTab() {const groups: readonly ShortcutCategory[] = ["general", "issue", "navigation"];+ const stopRecording = () => {+ setRecording(null);+ setPendingFirst(null);+ setCaptureError(null);+ };+const capture = (actionId: ShortcutActionId, event: React.KeyboardEvent) => {event.preventDefault();event.stopPropagation();if (event.repeat || isImeComposing(event)) return;if (event.key === "Escape") {- setRecording(null);- setCaptureError(null);+ stopRecording();return;}++ if (pendingFirst) {+ // Backspace takes the first key back; Enter keeps it as a single key.+ if (event.key === "Backspace" || event.key === "Delete") {+ setPendingFirst(null);+ setCaptureError(null);+ return;+ }+ if (event.key === "Enter") {+ commit(actionId, pendingFirst);+ return;+ }+ const then = shortcutFromEvent(event.nativeEvent);+ if (!then) {+ if (!isShortcutModifierKey(event.key)) setCaptureError({ kind: "unrecognized" });+ return;+ }+ commit(actionId, { ...pendingFirst, then });+ return;+ }+if (event.key === "Backspace" || event.key === "Delete") {setShortcut(actionId, null);- setRecording(null);- setCaptureError(null);+ stopRecording();return;}@@ -100,7 +129,16 @@ export function KeyboardShortcutsTab() {}return;}- if (isReservedShortcut(shortcut)) {+ if (canStartShortcutSequence(actionId, shortcut)) {+ setPendingFirst(shortcut);+ setCaptureError(null);+ return;+ }+ commit(actionId, shortcut, event.nativeEvent);+ };++ const commit = (actionId: ShortcutActionId, shortcut: ShortcutChord, event?: KeyboardEvent) => {+ if (isReservedShortcut(shortcutFirstStep(shortcut))) {setCaptureError({ kind: "reserved" });return;}@@ -108,15 +146,14 @@ export function KeyboardShortcutsTab() {setCaptureError({ kind: actionId === "send" ? "send" : "unsafe" });return;}- const conflict = findShortcutConflict(actionId, shortcut, event.nativeEvent);+ const conflict = findShortcutConflict(actionId, shortcut, event);if (conflict) {setCaptureError({ kind: "conflict", actionId: conflict });return;}setShortcut(actionId, shortcut);- setRecording(null);- setCaptureError(null);+ stopRecording();};return (@@ -169,15 +206,14 @@ export function KeyboardShortcutsTab() {action.id,)}recording={recording === action.id}+ pendingFirst={recording === action.id ? pendingFirst : null}error={recording === action.id ? captureError : null}onStartRecording={() => {setRecording(action.id);+ setPendingFirst(null);setCaptureError(null);}}- onCancelRecording={() => {- setRecording(null);- setCaptureError(null);- }}+ onCancelRecording={stopRecording}onCapture={(event) => capture(action.id, event)}onDisable={() => {setShortcut(action.id, null);@@ -234,8 +270,7 @@ export function KeyboardShortcutsTab() {variant="destructive"onClick={() => {resetAll();- setCaptureError(null);- setRecording(null);+ stopRecording();setResetConfirmOpen(false);}}>@@ -253,6 +288,7 @@ function ShortcutRow({shortcut,customized,recording,+ pendingFirst,error,onStartRecording,onCancelRecording,@@ -264,6 +300,7 @@ function ShortcutRow({shortcut: ShortcutChord | null;customized: boolean;recording: boolean;+ pendingFirst: ShortcutChord | null;error: CaptureError;onStartRecording: () => void;onCancelRecording: () => void;@@ -334,14 +371,20 @@ function ShortcutRow({)}aria-label={t(($) => $.shortcuts.record_aria, { action: label })}aria-pressed={recording}+ data-shortcut-recorder={recording ? "" : undefined}>- {recording ? (+ {pendingFirst ? (+ <span className="inline-flex items-center gap-1.5 font-sans">+ <ShortcutKeycaps shortcut={pendingFirst} layout="split" decorative />+ {t(($) => $.shortcuts.then)}…+ </span>+ ) : recording ? (<span className="inline-flex items-center gap-1.5 font-sans"><Keyboard className="size-3.5" />{t(($) => $.shortcuts.recording)}</span>) : shortcut ? (- <ShortcutKeycaps shortcut={shortcut} layout="split" decorative />+ <ShortcutKeycaps shortcut={shortcut} layout="split" decorative thenLabel={t(($) => $.shortcuts.then)} />) : (<span className="font-sans font-normal text-muted-foreground">{t(($) => $.shortcuts.unassigned)}@@ -373,9 +416,15 @@ function ShortcutRow({<span role="alert" className="max-w-72 text-right text-caption text-destructive">{errorText}</span>+ ) : pendingFirst ? (+ <span className="max-w-72 text-right text-micro text-muted-foreground">+ {t(($) => $.shortcuts.record_then_hint)}+ </span>) : recording ? (- <span className="text-right text-micro text-muted-foreground">- {t(($) => $.shortcuts.record_hint)}+ <span className="max-w-72 text-right text-micro text-muted-foreground">+ {action.category === "navigation"+ ? t(($) => $.shortcuts.record_sequence_hint)+ : t(($) => $.shortcuts.record_hint)}</span>) : null}</div>