Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

fix(panel): the / menu scrolls to keep the highlighted command or skill in view as the arrow keys move through it, and the composer names that option for screen readers

Shahriarfcb2fef668d8
diff --git a/src/extension/components/composer.tsx b/src/extension/components/composer.tsx
index d4e6d6d..732ed7a 100644
--- a/src/extension/components/composer.tsx
+++ b/src/extension/components/composer.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
+import { useEffect, useId, useMemo, useRef, useState, type MouseEvent } from 'react';
import {
CalendarClock,
Code2,
@@ -16,7 +16,7 @@ import {
X,
} from 'lucide-react';
-import { SkillMenu, skillMenuItems, type AndroidOption, type SkillMenuItem } from '@/extension/components/skill-menu';
+import { SkillMenu, skillMenuItems, skillOptionId, type AndroidOption, type SkillMenuItem } from '@/extension/components/skill-menu';
import type { SavedToolMeta } from '@/lib/bridge/saved-tools';
import { Button } from '@/extension/components/ui/button';
import { Textarea } from '@/extension/components/ui/textarea';
@@ -108,6 +108,7 @@ export function Composer({
const slash = voice.input.startsWith('/') ? voice.input.slice(1) : null;
const menuOpen = slash !== null && connected;
const [highlight, setHighlight] = useState(0);
+ const menuId = useId();
const menuItems = useMemo(
() => (menuOpen ? skillMenuItems(catalog, tabUrl, slash ?? '', tools, { handsFree, android }) : []),
[menuOpen, catalog, tabUrl, slash, tools, handsFree, android],
@@ -199,6 +200,7 @@ export function Composer({
>
{menuOpen && (
<SkillMenu
+ id={menuId}
items={menuItems}
agent={catalog?.agent}
highlight={highlight}
@@ -208,6 +210,8 @@ export function Composer({
)}
<Textarea
ref={composerRef}
+ aria-controls={menuOpen ? menuId : undefined}
+ aria-activedescendant={menuOpen && menuItems.length > 0 ? skillOptionId(menuId, highlight) : undefined}
value={voice.input}
onChange={(event) => voice.setInput(event.target.value)}
onKeyDown={(event) => {
diff --git a/src/extension/components/skill-menu.tsx b/src/extension/components/skill-menu.tsx
index edc3b45..d3b5881 100644
--- a/src/extension/components/skill-menu.tsx
+++ b/src/extension/components/skill-menu.tsx
@@ -1,3 +1,4 @@
+import { useEffect, useRef } from 'react';
import { BookOpen, Globe, Sparkles, SquareSlash, Zap } from 'lucide-react';
import type { SkillCatalog } from '@/lib/actions/protocol';
@@ -140,13 +141,25 @@ export function skillMenuItems(
return matched.sort((a, b) => GROUP_ORDER[a.group] - GROUP_ORDER[b.group] || a.name.localeCompare(b.name));
}
+/** Moves only the menu: `scrollIntoView` would scroll the side panel around it too. */
+function keepInView(list: HTMLElement, row: HTMLElement): void {
+ if (row.offsetTop < list.scrollTop) list.scrollTop = row.offsetTop;
+ else if (row.offsetTop + row.offsetHeight > list.scrollTop + list.clientHeight) {
+ list.scrollTop = row.offsetTop + row.offsetHeight - list.clientHeight;
+ }
+}
+
+export const skillOptionId = (menuId: string, index: number) => `${menuId}-option-${index}`;
+
export function SkillMenu({
+ id,
items,
agent,
highlight,
onHover,
onSelect,
}: {
+ id: string;
items: SkillMenuItem[];
agent: SkillCatalog['agent'] | undefined;
highlight: number;
@@ -162,8 +175,23 @@ export function SkillMenu({
'other-site': 'Other sites',
};
+ const list = useRef<HTMLDivElement>(null);
+ // A row the pointer reached is already in view, and scrolling to it would slide the next row under the pointer.
+ const pointed = useRef(false);
+
+ useEffect(() => {
+ if (pointed.current) {
+ pointed.current = false;
+ return;
+ }
+ const row = list.current?.children[highlight];
+ if (list.current && row instanceof HTMLElement) keepInView(list.current, row);
+ }, [highlight, items]);
+
return (
<div
+ ref={list}
+ id={id}
role="listbox"
aria-label="Skills and commands"
className="enters absolute inset-x-0 bottom-full z-20 mb-2 max-h-64 overflow-y-auto rounded-xl border border-line bg-surface shadow-lg"
@@ -180,11 +208,16 @@ export function SkillMenu({
)}
<button
type="button"
+ id={skillOptionId(id, index)}
role="option"
aria-selected={index === highlight}
aria-disabled={item.unavailable ? true : undefined}
title={item.unavailable}
- onMouseEnter={() => onHover(index)}
+ onMouseEnter={() => {
+ if (index === highlight) return;
+ pointed.current = true;
+ onHover(index);
+ }}
onMouseDown={(event) => {
event.preventDefault();
onSelect(item);