mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-12-03 09:09:33 +01:00
fix: apply the review items for #685 at merge
palette agent switch: aria-hidden on .command-palette-agent, arrows lose role="button" and aria-label (no nested buttons in the row) i18n: zh-CN entry for the "Agent for the new session (Left/Right to change)" tooltip docs: Keyboard-Shortcuts Ctrl+K row says Left/Right change the agent on the New session row test: pin the aria-hidden switch and the zh-CN tooltip entry in command-palette-ui.test.ts Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c6a5995ac6
commit
d16172c4b8
4 files changed
+24
-6
No files matched your search
@@ -8,7 +8,7 @@ Press `Ctrl+?` in the app for the same list in a floating overlay.
|
|||||||
|
|
||||||
| Shortcut | Action |
|
| Shortcut | Action |
|
||||||
| ------------------------------- | --------------------------------------------------------------- |
|
| ------------------------------- | --------------------------------------------------------------- |
|
||||||
| `Ctrl+K` (also `Cmd+K`, `Alt+K`)| Find an open session or start a new one. |
|
| `Ctrl+K` (also `Cmd+K`, `Alt+K`)| Find an open session or start a new one. On the **New session** row, `Left` / `Right` change the agent it starts. |
|
||||||
| `Ctrl+Tab` | Next session. |
|
| `Ctrl+Tab` | Next session. |
|
||||||
| `Alt+[` / `Alt+]` | Previous / next tab. |
|
| `Alt+[` / `Alt+]` | Previous / next tab. |
|
||||||
| `Alt+1` to `Alt+9` | Switch to tab N. Physical keys, so macOS Option layouts work. |
|
| `Alt+1` to `Alt+9` | Switch to tab N. Physical keys, so macOS Option layouts work. |
|
||||||
|
|||||||
@@ -94,6 +94,8 @@
|
|||||||
'Move to Ungrouped': '移到未分组',
|
'Move to Ungrouped': '移到未分组',
|
||||||
'Move to new group': '移到新分组',
|
'Move to new group': '移到新分组',
|
||||||
'New session': '新建会话',
|
'New session': '新建会话',
|
||||||
|
// The Cmd+K palette's new-session agent switch (panels-ui.js, its title tooltip).
|
||||||
|
'Agent for the new session (Left/Right to change)': '新会话使用的智能体(按左/右方向键切换)',
|
||||||
'A session is already starting.': '已有会话正在启动。',
|
'A session is already starting.': '已有会话正在启动。',
|
||||||
'Follow parent again': '重新跟随父会话',
|
'Follow parent again': '重新跟随父会话',
|
||||||
'Parent closed; placed on its own': '父会话已关闭;单独放置',
|
'Parent closed; placed on its own': '父会话已关闭;单独放置',
|
||||||
|
|||||||
@@ -694,19 +694,21 @@ Object.assign(CodemanApp.prototype, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The new-session row's agent switch: arrows either side of the agent's logo
|
* The new-session row's agent switch: arrows either side of the agent's logo
|
||||||
* and name. Spans, not buttons: the row itself is a <button>. Nothing is drawn
|
* and name. Spans, not buttons: the row itself is a <button>. The switch is
|
||||||
* when there is nothing to choose between.
|
* aria-hidden (no nested buttons; the row's subtitle already names the agent),
|
||||||
|
* and its arrows work by click through data-palette-agent-cycle. Nothing is
|
||||||
|
* drawn when there is nothing to choose between.
|
||||||
*/
|
*/
|
||||||
_renderCommandPaletteAgentPicker(mode) {
|
_renderCommandPaletteAgentPicker(mode) {
|
||||||
const choices = this._commandPaletteAgentChoices();
|
const choices = this._commandPaletteAgentChoices();
|
||||||
if (choices.length < 2) return '';
|
if (choices.length < 2) return '';
|
||||||
const agent = choices.find((c) => c.id === mode) || choices[0];
|
const agent = choices.find((c) => c.id === mode) || choices[0];
|
||||||
return `
|
return `
|
||||||
<span class="command-palette-agent" title="Agent for the new session (Left/Right to change)">
|
<span class="command-palette-agent" aria-hidden="true" title="Agent for the new session (Left/Right to change)">
|
||||||
<span class="command-palette-agent-arrow" role="button" data-palette-agent-cycle="prev" aria-label="Previous agent">‹</span>
|
<span class="command-palette-agent-arrow" data-palette-agent-cycle="prev">‹</span>
|
||||||
<span class="run-mode-dot ${escapeHtml(agent.id)}" aria-hidden="true"></span>
|
<span class="run-mode-dot ${escapeHtml(agent.id)}" aria-hidden="true"></span>
|
||||||
<span class="command-palette-agent-label">${escapeHtml(agent.label)}</span>
|
<span class="command-palette-agent-label">${escapeHtml(agent.label)}</span>
|
||||||
<span class="command-palette-agent-arrow" role="button" data-palette-agent-cycle="next" aria-label="Next agent">›</span>
|
<span class="command-palette-agent-arrow" data-palette-agent-cycle="next">›</span>
|
||||||
</span>`;
|
</span>`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -387,6 +387,20 @@ describe('Command-K new-session agent picker', () => {
|
|||||||
expect(elements.commandPaletteList.innerHTML).toContain('run-mode-dot opencode');
|
expect(elements.commandPaletteList.innerHTML).toContain('run-mode-dot opencode');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('keeps the switch out of the row button accessible name and gives its tooltip a zh-CN entry', () => {
|
||||||
|
const { app, elements } = loadAgentPalette();
|
||||||
|
app.openCommandPalette();
|
||||||
|
const html = elements.commandPaletteList.innerHTML;
|
||||||
|
const title = 'Agent for the new session (Left/Right to change)';
|
||||||
|
|
||||||
|
// No nested buttons inside the row's <button>: the subtitle names the agent.
|
||||||
|
expect(html).toContain(`class="command-palette-agent" aria-hidden="true" title="${title}"`);
|
||||||
|
expect(html).not.toContain('role="button"');
|
||||||
|
expect(html).not.toContain('aria-label=');
|
||||||
|
const i18n = readFileSync(resolve(import.meta.dirname, '../src/web/public/i18n.js'), 'utf8');
|
||||||
|
expect(i18n.split(`'${title}':`).length - 1).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
it('falls back to the first offered agent when the Run button mode is not offered', () => {
|
it('falls back to the first offered agent when the Run button mode is not offered', () => {
|
||||||
const { app } = loadAgentPalette();
|
const { app } = loadAgentPalette();
|
||||||
app._runMode = 'codex'; // not installed
|
app._runMode = 'codex'; // not installed
|
||||||
|
|||||||
Reference in new issue
Block a user