@@ -16596,6 +16596,30 @@ test('chrome sidepanel Escape abort honors slash autocomplete dismissal', () =>
1659616596 assert.equal(abortCall < recordingEscapeCall, true, 'chrome: agent-run Escape abort should take precedence over recording stop');
1659716597});
1659816598
16599+ test('firefox sidepanel implements documented global keyboard shortcuts', () => {
16600+ const panel = fs.readFileSync(path.join(ROOT, 'src/firefox/src/ui/sidepanel.js'), 'utf8');
16601+ const locale = fs.readFileSync(path.join(ROOT, 'src/firefox/src/ui/locales/en.js'), 'utf8');
16602+
16603+ const globalHandlerStart = panel.indexOf('async function handleGlobalKeydown(e)');
16604+ const defaultPreventedGuard = panel.indexOf('if (e.defaultPrevented) return;', globalHandlerStart);
16605+ const abortCall = panel.indexOf('abortRun();', globalHandlerStart);
16606+ assert.notEqual(globalHandlerStart, -1, 'firefox: global keydown handler missing');
16607+ assert.notEqual(defaultPreventedGuard, -1, 'firefox: global keydown handler should honor consumed key events');
16608+ assert.notEqual(abortCall, -1, 'firefox: Escape abort shortcut missing');
16609+ assert.equal(defaultPreventedGuard < abortCall, true, 'firefox: consumed slash-menu Escape should not reach abortRun');
16610+ assert.match(panel, /document\.addEventListener\('keydown', handleGlobalKeydown, true\)/, 'firefox: shortcuts should run in capture phase');
16611+ assert.match(panel, /mod && e\.key === '\/'/, 'firefox: Ctrl/Cmd+/ focus shortcut missing');
16612+ assert.match(panel, /mod && e\.shiftKey && e\.key === 'A'/, 'firefox: Ask mode shortcut missing');
16613+ assert.match(panel, /mod && e\.shiftKey && e\.key === 'X'/, 'firefox: Act mode shortcut missing');
16614+ assert.match(panel, /mod && e\.shiftKey && e\.key === 'D'/, 'firefox: Dev mode shortcut missing');
16615+ assert.match(panel, /await ensureActMode\(\)/, 'firefox: Act shortcut should call ensureActMode');
16616+ assert.match(panel, /await ensureDevMode\(\)/, 'firefox: Dev shortcut should call ensureDevMode');
16617+
16618+ for (const shortcut of ['Ctrl/Cmd+/', 'Ctrl/Cmd+Shift+A', 'Ctrl/Cmd+Shift+X', 'Ctrl/Cmd+Shift+D', 'Escape']) {
16619+ assert.match(locale, new RegExp(escapeRegExpLiteral(shortcut)), `firefox: /help should mention ${shortcut}`);
16620+ }
16621+ });
16622+
1659916623test('chrome double Escape stops active recordings from sidepanel and content pages', () => {
1660016624 const panel = fs.readFileSync(path.join(ROOT, 'src/chrome/src/ui/sidepanel.js'), 'utf8');
1660116625 const content = fs.readFileSync(path.join(ROOT, 'src/chrome/src/content/content.js'), 'utf8');
0 commit comments