Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(a11y): drop role=menu from popovers that don't implement its keys
Louis Deconinck32bc24378d8d
diff --git a/client/src/a11yConventions.test.js b/client/src/a11yConventions.test.jsindex 644f7b4413..152d00e403 100644--- a/client/src/a11yConventions.test.js+++ b/client/src/a11yConventions.test.js@@ -3799,4 +3799,109 @@ function B() { const sensors = useSensors(useSensor(PointerSensor)); return <Dnd}expect(offenders, `Hand-rolled role="tablist" — render the shared components/ui/TabPills.jsx instead; it owns the roving tabindex + Arrow/Home/End contract a hand-rolled bar cannot honor (WCAG 4.1.2):\n${offenders.join('\n')}`).toEqual([]);});++ // --- menu roles only where the contract is implemented (#7265) --------------+ //+ // `role="menu"` is the same class of promise as `role="tablist"` — screen+ // readers suppress the browse cursor inside it and drive the contents with+ // ArrowUp/ArrowDown roving focus, Home/End jumps, and Escape returning focus+ // to the trigger. Claiming the role without implementing those keys makes+ // the contents unreachable by the means the role announced (WCAG 4.1.2), and+ // a menu may only own menuitem/group/separator children — a textbox or form+ // inside it is an additional violation. Two components keep the contract:+ // `components/ui/OverflowMenu.jsx` and `components/ThemeSwitcher.jsx`. The+ // seven audited popovers that didn't dropped the claim in #7265 — the+ // `ShellProviderLauncher.jsx` precedent, which keeps a plain named group of+ // controls that Tab reaches natively. This scan is the backstop that keeps+ // the eighth copy from landing.++ // Files allowed to write menu-family roles — each implements the arrow-key+ // contract itself. The allowlist only shrinks; a new compliant menu goes+ // through `ui/OverflowMenu.jsx` instead of re-deriving the semantics.+ const MENU_CONTRACT_ALLOWLIST = new Set([+ 'src/components/ui/OverflowMenu.jsx',+ 'src/components/ThemeSwitcher.jsx',+ ]);++ // The whole menu role family, not just "menu": BulkTargetPicker's rows were+ // `role="menuitem"` in a different file than the `role="menu"` container, so+ // a menu-only scan would have missed the row half of the audited defect.+ const MENU_CONTRACT_ROLES = new Set(['menu', 'menubar', 'menuitem', 'menuitemcheckbox', 'menuitemradio']);++ // The file-level "did anyone implement the promised keys" question. Any+ // arrow key counts — a `menubar` legitimately answers Left/Right where a+ // `menu` answers Up/Down. Comments are masked before this runs, so a doc+ // comment mentioning ArrowDown can't forge the exemption.+ const implementsArrowKeys = (src) => /\bArrow(?:Up|Down|Left|Right)\b/.test(src);++ // Every element whose `role` attribute literally reads a menu-family role.+ // Reading the answer off the parsed tag covers `role="menu"`, `role='menu'`+ // and `role={'menu'}` as one question; a commented-out example is masked+ // before the walk; a `closest('[role="menu"]')` selector string+ // (meatspace/post/ElementsSong.jsx) is never a tag's role; and a dynamic+ // `role={expr}` resolves to no verdict — left to review rather than guessed.+ const menuContractSites = function* (src) {+ // 'menu' absent → lexing the file cannot yield a menu-family tag.+ if (!src.includes('menu')) return;+ for (const node of forEachOpeningTag(src)) {+ if (MENU_CONTRACT_ROLES.has(normalizedAttributeValue(attributeValue(node.tag, 'role')))) yield node;+ }+ };++ it('ships menu roles only where arrow-key focus management backs them (#7265)', () => {+ const offendersIn = (file, src) => {+ if (MENU_CONTRACT_ALLOWLIST.has(file)) return [];+ const sites = [...menuContractSites(src)];+ if (sites.length === 0 || implementsArrowKeys(src)) return [];+ return sites.map(({ index }) => `${file}:${lineOf(src, index)}`);+ };++ // Probes first — the tree is green by construction, so fixtures carry the+ // proof that the walk rejects what the rule exists to reject.+ const probe = (src, file = 'src/components/probe/Probe.jsx') => offendersIn(file, src);+ // The audited shape: a menu claim with no arrow-key handling behind it.+ expect(probe('<div role="menu"><button role="menuitem">A</button></div>'))+ .toEqual(['src/components/probe/Probe.jsx:1', 'src/components/probe/Probe.jsx:1']);+ // A bare menuitem in a file with no menu container is the same broken+ // contract — the row half of the audited defect lived in its own file.+ expect(probe('<ul><li><button role="menuitemcheckbox">B</button></li></ul>'))+ .toEqual(['src/components/probe/Probe.jsx:1']);+ // Whichever way the literal is spelled, and wherever the tag starts.+ expect(probe("<ul\n role='menu'\n/>")).toEqual(['src/components/probe/Probe.jsx:1']);+ expect(probe('<div role={"menu"} />')).toEqual(['src/components/probe/Probe.jsx:1']);+ // A menu WITH arrow-key handling keeps its contract — allowed anywhere.+ expect(probe('const onKey = (e) => e.key === "ArrowDown" && focusNext();\n<div role="menu" onKeyDown={onKey} />')).toEqual([]);+ expect(probe('const onKey = (e) => e.key === "ArrowRight" && focusNext();\n<div role="menubar" onKeyDown={onKey} />')).toEqual([]);+ // The allowlisted primitives are exempt by name.+ expect(probe('<div role="menu" />', 'src/components/ui/OverflowMenu.jsx')).toEqual([]);+ expect(probe('<div role="menuitemradio" />', 'src/components/ThemeSwitcher.jsx')).toEqual([]);+ // A selector string is not a role attribute, a commented example is masked+ // before the walk, and a dynamic role is unverifiable — out of remit.+ expect(probe('<div onKeyDown={(e) => e.target.closest?.("[role=\\"menu\\"]") && f()} />')).toEqual([]);+ expect(probe(maskComments('{/* <div role="menu" /> */}'))).toEqual([]);+ expect(probe('<div data-note="menu" role={roleFor(kind)} />')).toEqual([]);+ // A comment naming the keys does not forge the exemption either.+ expect(probe(maskComments('// ArrowDown is handled by the caller\n<div role="menu" />')))+ .toEqual(['src/components/probe/Probe.jsx:2']);++ // The allowlist is pinned to reality: both primitives must still write a+ // menu-family role AND still implement the keys that exempt them.+ for (const allowed of MENU_CONTRACT_ALLOWLIST) {+ const src = maskedSourceOf(allowed);+ expect(+ [...menuContractSites(src)].length,+ `${allowed} no longer writes a menu-family role — drop it from MENU_CONTRACT_ALLOWLIST`,+ ).toBeGreaterThanOrEqual(1);+ expect(+ implementsArrowKeys(src),+ `${allowed} lost its arrow-key handling — the role now promises keys nothing answers`,+ ).toBe(true);+ }++ const offenders = [];+ for (const file of trackedSourceFiles()) {+ offenders.push(...offendersIn(file, maskedSourceOf(file)));+ }+ expect(offenders, `Menu-family role without arrow-key focus management — a role="menu" promises ArrowUp/ArrowDown roving focus, Home/End and Escape-to-trigger that a hand-rolled popover doesn't implement (WCAG 4.1.2). Drop the role (the ShellProviderLauncher.jsx precedent: a named group of plain controls needs none) or route the popover through components/ui/OverflowMenu.jsx:\n${offenders.join('\n')}`).toEqual([]);+ });});diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex 9abce02605..7a0031c476 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -657,7 +657,6 @@ export default function Layout() {onClick={navigateToSection}className={`flex-1 min-w-0 ${sectionRowClasses} ${sidebarCollapsed ? 'lg:justify-center lg:px-2' : 'justify-between'}`}title={sidebarCollapsed ? item.label : undefined}- aria-haspopup={hasChildrenForFlyout ? 'menu' : undefined}aria-expanded={hasChildrenForFlyout ? flyoutSection === item.label : undefined}><div className="flex items-center gap-3 min-w-0">@@ -957,10 +956,13 @@ export default function Layout() {{collapsed && flyoutSection && (() => {const item = resolvedNavItems.find((i) => i.label === flyoutSection);if (!item || !item.children || item.children.length === 0) return null;+ // A list of navigation links, not a command menu — so <nav> + <ul>/<li>,+ // NOT role="menu"/"menuitem": those roles promise arrow-key roving+ // focus between items that this flyout doesn't implement (#7265).+ // Native Tab order reaches every link.return (- <div+ <navref={flyoutRef}- role="menu"aria-label={`${item.label} pages`}onMouseEnter={cancelCloseFlyout}onMouseLeave={scheduleCloseFlyout}@@ -972,57 +974,61 @@ export default function Layout() {<div className="px-3 py-1.5 text-[10px] uppercase text-gray-500 tracking-wider border-b border-port-border mb-1">{item.label}</div>- {item.children.map((child, childIndex) => {- if (child.separator) {- return <div key={`flyout-sep-${childIndex}`} className="mx-3 my-1 border-t border-port-border" />;- }- const ChildIcon = child.icon;- if (child.external) {- const childHref = child.dynamicHost- ? `${window.location.protocol}//${window.location.hostname}${child.href.replace('//', '')}`- : child.href;+ <ul>+ {item.children.map((child, childIndex) => {+ if (child.separator) {+ // Decorative rule, not an item — hidden so it doesn't pad the+ // list's "N items" count for screen readers.+ return <li key={`flyout-sep-${childIndex}`} aria-hidden="true" className="mx-3 my-1 border-t border-port-border" />;+ }+ const ChildIcon = child.icon;+ if (child.external) {+ const childHref = child.dynamicHost+ ? `${window.location.protocol}//${window.location.hostname}${child.href.replace('//', '')}`+ : child.href;+ return (+ <li key={`flyout-${child.href}`}>+ <a+ href={childHref}+ target="_blank"+ rel="noopener noreferrer"+ onClick={() => setFlyoutSection(null)}+ title={child.label}+ className="flex items-start justify-between gap-3 px-3 py-2 text-sm text-gray-300 hover:text-white hover:bg-port-border/50 min-w-0"+ >+ <div className="flex items-start gap-3 min-w-0">+ <ChildIcon size={16} className="shrink-0 mt-0.5" aria-hidden="true" />+ <span className="min-w-0 break-words leading-snug">{child.label}</span>+ </div>+ <ExternalLink size={12} className="text-gray-500 shrink-0 mt-0.5" />+ </a>+ </li>+ );+ }+ const childActive = child.end+ ? location.pathname === child.to+ : isActive(child.to);return (- <a- key={`flyout-${child.href}`}- href={childHref}- target="_blank"- rel="noopener noreferrer"- role="menuitem"- onClick={() => setFlyoutSection(null)}- title={child.label}- className="flex items-start justify-between gap-3 px-3 py-2 text-sm text-gray-300 hover:text-white hover:bg-port-border/50 min-w-0"- >- <div className="flex items-start gap-3 min-w-0">+ <li key={`flyout-${child.to}`}>+ <NavLink+ to={child.to}+ end={child.end}+ onClick={() => setFlyoutSection(null)}+ title={child.label}+ className={`flex items-start gap-3 px-3 py-2 text-sm min-w-0 ${+ childActive+ ? 'bg-port-accent/10 text-port-accent'+ : 'text-gray-300 hover:text-white hover:bg-port-border/50'+ }`}+ ><ChildIcon size={16} className="shrink-0 mt-0.5" aria-hidden="true" /><span className="min-w-0 break-words leading-snug">{child.label}</span>- </div>- <ExternalLink size={12} className="text-gray-500 shrink-0 mt-0.5" />- </a>+ </NavLink>+ </li>);- }- const childActive = child.end- ? location.pathname === child.to- : isActive(child.to);- return (- <NavLink- key={`flyout-${child.to}`}- to={child.to}- end={child.end}- role="menuitem"- onClick={() => setFlyoutSection(null)}- title={child.label}- className={`flex items-start gap-3 px-3 py-2 text-sm min-w-0 ${- childActive- ? 'bg-port-accent/10 text-port-accent'- : 'text-gray-300 hover:text-white hover:bg-port-border/50'- }`}- >- <ChildIcon size={16} className="shrink-0 mt-0.5" aria-hidden="true" />- <span className="min-w-0 break-words leading-snug">{child.label}</span>- </NavLink>- );- })}- </div>+ })}+ </ul>+ </nav>);})()}diff --git a/client/src/components/dashboard/LayoutPicker.jsx b/client/src/components/dashboard/LayoutPicker.jsxindex 8dbf4c0587..a5303bec8d 100644--- a/client/src/components/dashboard/LayoutPicker.jsx+++ b/client/src/components/dashboard/LayoutPicker.jsx@@ -72,14 +72,17 @@ export default function LayoutPicker({ layouts, activeLayoutId, onSelect, onEdittitle="Switch dashboard layout"aria-label={`Dashboard layout: ${active?.name || 'none'}`}aria-expanded={open}- aria-haspopup="true"><LayoutGrid size={14} aria-hidden="true" /><span className="hidden sm:inline">{active?.name || 'Layout'}</span></button>{open && (+ // role="group" so the aria-label actually lands — a bare <div> is+ // generic and name-prohibited. Not role="menu": no arrow-key roving+ // focus is implemented here (#7265).<div+ role="group"aria-label="Dashboard layout menu"className={`w-56 max-w-[calc(100vw-1rem)] bg-port-card border border-port-border rounded-lg shadow-2xl overflow-hidden z-50 ${menuPos ? '' : 'absolute right-0 mt-1'}`}style={menuPos || undefined}diff --git a/client/src/components/media/AddToCollectionMenu.jsx b/client/src/components/media/AddToCollectionMenu.jsxindex e398cc6bb5..035d3f3f78 100644--- a/client/src/components/media/AddToCollectionMenu.jsx+++ b/client/src/components/media/AddToCollectionMenu.jsx@@ -55,13 +55,11 @@ export default function AddToCollectionMenu({ item, size = 'sm' }) {const inIt = c.items.some((it) => `${it.kind}:${it.ref}` === itemKey);return (<button- key={c.id}type="button"disabled={busyId === c.id}onClick={() => handleToggleMembership(c, updateCollections)}className="w-full flex items-center justify-between gap-2 px-2 py-1.5 text-left text-[12px] text-gray-200 hover:bg-port-border rounded disabled:opacity-50"- role="menuitemcheckbox"- aria-checked={inIt}+ aria-pressed={inIt}><CollectionRowLabel name={c.name} />{inIt && <Check className="w-3.5 h-3.5 text-port-success shrink-0" />}@@ -97,7 +95,6 @@ export default function AddToCollectionMenu({ item, size = 'sm' }) {onClick={handleToggleOpen}className={`shrink-0 ${sizeCls.button} bg-port-border hover:bg-port-border/70 text-white rounded flex items-center justify-center`}title="Add to collection" aria-label="Add to collection"- aria-haspopup="menu"aria-expanded={open}><FolderPlus className={sizeCls.icon} />diff --git a/client/src/components/media/AddToCollectionMenu.test.jsx b/client/src/components/media/AddToCollectionMenu.test.jsxindex 3fad5b8aa5..1ddd2535e6 100644--- a/client/src/components/media/AddToCollectionMenu.test.jsx+++ b/client/src/components/media/AddToCollectionMenu.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach } from 'vitest';-import { render, screen, fireEvent, act } from '@testing-library/react';+import { render, screen, fireEvent, act, within } from '@testing-library/react';import AddToCollectionMenu from './AddToCollectionMenu';// Covers the picker's list presentation (#3312): CollectionPickerShell orders@@ -35,11 +35,13 @@ const collections = [const openMenu = async () => {render(<AddToCollectionMenu item={item} />);fireEvent.click(screen.getByTitle('Add to collection'));- await screen.findByRole('menuitemcheckbox', { name: /Keepers/ });+ await screen.findByRole('button', { name: /Keepers/ });};+// The rows live in the picker's <ul>; the trigger and the create-form submit+// are also buttons, so scope the query to the list.const rowTitles = () =>- screen.getAllByRole('menuitemcheckbox').map((el) => el.textContent.trim());+ within(screen.getByRole('list')).getAllByRole('button').map((el) => el.textContent.trim());beforeEach(() => {vi.clearAllMocks();@@ -63,7 +65,7 @@ describe('AddToCollectionMenu row presentation', () => {it('lifts the auto-creator prefix into a badge and keeps the full name as the tooltip', async () => {await openMenu();- const row = screen.getByRole('menuitemcheckbox', { name: /Zephyr Drift/ });+ const row = screen.getByRole('button', { name: /Zephyr Drift/ });expect(row.querySelector('[title]')).toHaveAttribute('title', 'Creative Director: Zephyr Drift');// The badge is its own element so the distinguishing tail owns the row width.expect(screen.getAllByText('Creative Director')).toHaveLength(2);@@ -73,8 +75,8 @@ describe('AddToCollectionMenu row presentation', () => {it('still lists empty collections — filing INTO an empty collection is the point', async () => {await openMenu();- expect(screen.getByRole('menuitemcheckbox', { name: /Wallpapers/ })).toBeInTheDocument();- expect(screen.getByRole('menuitemcheckbox', { name: /Example Universe/ })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: /Wallpapers/ })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: /Example Universe/ })).toBeInTheDocument();});it('matches search tokens in any order (AND-token, not a single substring)', async () => {diff --git a/client/src/components/media/BulkTargetPicker.jsx b/client/src/components/media/BulkTargetPicker.jsxindex b223d36fe5..8067e04821 100644--- a/client/src/components/media/BulkTargetPicker.jsx+++ b/client/src/components/media/BulkTargetPicker.jsx@@ -27,12 +27,10 @@ export default function BulkTargetPicker({}) {const renderItem = useCallback((c) => (<button- key={c.id}type="button"disabled={busy}onClick={() => onPick(c.id, c.name)}className="w-full flex items-center gap-2 px-2 py-1.5 text-left text-[12px] text-gray-200 hover:bg-port-border rounded disabled:opacity-50"- role="menuitem"><CollectionRowLabel name={c.name} /><span className="text-[10px] text-gray-500 shrink-0">{c.items?.length ?? 0}</span>diff --git a/client/src/components/media/CollectionPickerShell.jsx b/client/src/components/media/CollectionPickerShell.jsxindex 3e2e9caeda..f4e57a81c8 100644--- a/client/src/components/media/CollectionPickerShell.jsx+++ b/client/src/components/media/CollectionPickerShell.jsx@@ -193,9 +193,16 @@ export default function CollectionPickerShell({const list = filtered;return createPortal(+ // Deliberately NOT role="menu" (see #7265): that role promises arrow-key+ // roving focus among menuitem-only children, and this popover owns a search+ // input, an inline create <form>, and rows that are plain toggle buttons —+ // none of which are permitted menu children. role="group" + the title as+ // aria-label names the popover without claiming a contract we don't keep;+ // Tab reaches every control natively (same call ShellProviderLauncher made).<divref={menuRef}- role="menu"+ role="group"+ aria-label={title}className="fixed bg-port-card border border-port-border rounded-lg shadow-xl z-[100] p-1.5 flex flex-col max-h-dvh-cap"style={{left: style?.left ?? `${VIEWPORT_PADDING}px`,@@ -234,7 +241,14 @@ export default function CollectionPickerShell({{list != null && collectionsState?.length > 0 && list.length === 0 && (<div className="text-[11px] text-gray-500 px-2 py-2">{noMatchMessage(query)}</div>)}- {list != null && list.map((c) => renderItem(c, { updateCollections }))}+ {list != null && list.length > 0 && (+ // A real list — "list, N items" is the honest announcement for these+ // rows; the roles menu/menuitem promised arrow-key navigation this+ // popover does not implement.+ <ul>+ {list.map((c) => <li key={c.id}>{renderItem(c, { updateCollections })}</li>)}+ </ul>+ )}</div><form onSubmit={handleCreate} className="mt-1.5 pt-1.5 border-t border-port-border flex gap-1 shrink-0"><inputdiff --git a/client/src/components/media/PinToMoodBoardMenu.jsx b/client/src/components/media/PinToMoodBoardMenu.jsxindex 6a03e7abc8..e420dcff26 100644--- a/client/src/components/media/PinToMoodBoardMenu.jsx+++ b/client/src/components/media/PinToMoodBoardMenu.jsx@@ -126,13 +126,11 @@ export default function PinToMoodBoardMenu({ item, size = 'sm' }) {const pinned = !!findPinned(board, pinKey);return (<button- key={board.id}type="button"disabled={busyId === board.id}onClick={() => handleTogglePin(board, updateCollections)}className="w-full flex items-center justify-between gap-2 px-2 py-1.5 text-left text-[12px] text-gray-200 hover:bg-port-border rounded disabled:opacity-50"- role="menuitemcheckbox"- aria-checked={pinned}+ aria-pressed={pinned}><span className="break-words min-w-0 flex-1">{board.name}</span>{pinned && <Check className="w-3.5 h-3.5 text-port-success shrink-0" />}@@ -174,7 +172,6 @@ export default function PinToMoodBoardMenu({ item, size = 'sm' }) {onClick={handleToggleOpen}className={`shrink-0 ${sizeCls.button} bg-port-border hover:bg-port-border/70 text-white rounded flex items-center justify-center`}title="Pin to mood board" aria-label="Pin to mood board"- aria-haspopup="menu"aria-expanded={open}><LayoutGrid className={sizeCls.icon} />diff --git a/client/src/components/media/PinToMoodBoardMenu.test.jsx b/client/src/components/media/PinToMoodBoardMenu.test.jsxindex 6ccac3ce92..060b7cef38 100644--- a/client/src/components/media/PinToMoodBoardMenu.test.jsx+++ b/client/src/components/media/PinToMoodBoardMenu.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach } from 'vitest';-import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';+import { render, screen, fireEvent, waitFor, act, within } from '@testing-library/react';import PinToMoodBoardMenu from './PinToMoodBoardMenu';// Mock the api surface the menu (and the shared shell) reach for.@@ -36,8 +36,8 @@ describe('PinToMoodBoardMenu', () => {render(<PinToMoodBoardMenu item={imageItem} />);fireEvent.click(screen.getByTitle('Pin to mood board'));- const row = await screen.findByRole('menuitemcheckbox', { name: /Refs/ });- expect(row).toHaveAttribute('aria-checked', 'false');+ const row = await screen.findByRole('button', { name: /Refs/ });+ expect(row).toHaveAttribute('aria-pressed', 'false');await act(async () => { fireEvent.click(row); });@@ -47,7 +47,7 @@ describe('PinToMoodBoardMenu', () => {{ silent: true },);// Membership flips locally without a refetch.- await waitFor(() => expect(row).toHaveAttribute('aria-checked', 'true'));+ await waitFor(() => expect(row).toHaveAttribute('aria-pressed', 'true'));});it('unpins when the board already contains the media-key (toggle)', async () => {@@ -59,14 +59,14 @@ describe('PinToMoodBoardMenu', () => {render(<PinToMoodBoardMenu item={imageItem} />);fireEvent.click(screen.getByTitle('Pin to mood board'));- const row = await screen.findByRole('menuitemcheckbox', { name: /Refs/ });- expect(row).toHaveAttribute('aria-checked', 'true');+ const row = await screen.findByRole('button', { name: /Refs/ });+ expect(row).toHaveAttribute('aria-pressed', 'true');await act(async () => { fireEvent.click(row); });expect(api.removeMoodBoardItem).toHaveBeenCalledWith('b1', 'mbi-9', { silent: true });expect(api.addMoodBoardItem).not.toHaveBeenCalled();- await waitFor(() => expect(row).toHaveAttribute('aria-checked', 'false'));+ await waitFor(() => expect(row).toHaveAttribute('aria-pressed', 'false'));});it('pins mediaKey-only when previewUrl is a non-renderable (blob) URL', async () => {@@ -75,7 +75,7 @@ describe('PinToMoodBoardMenu', () => {render(<PinToMoodBoardMenu item={{ kind: 'video', key: 'video:job-7', previewUrl: null }} />);fireEvent.click(screen.getByTitle('Pin to mood board'));- const row = await screen.findByRole('menuitemcheckbox', { name: /Refs/ });+ const row = await screen.findByRole('button', { name: /Refs/ });await act(async () => { fireEvent.click(row); });expect(api.addMoodBoardItem).toHaveBeenCalledWith(@@ -93,7 +93,7 @@ describe('PinToMoodBoardMenu', () => {kind: 'image', key: 'canon-sheet:hero:sheet.png', previewUrl: '/data/image-refs/sheet.png',}} />);fireEvent.click(screen.getByTitle('Pin to mood board'));- const row = await screen.findByRole('menuitemcheckbox', { name: /Refs/ });+ const row = await screen.findByRole('button', { name: /Refs/ });await act(async () => { fireEvent.click(row); });// The server rejects `canon-sheet:` as a mediaKey, so we send imageUrl only.@@ -114,8 +114,8 @@ describe('PinToMoodBoardMenu', () => {kind: 'image', key: 'canon-sheet:hero:sheet.png', previewUrl: '/data/image-refs/sheet.png',}} />);fireEvent.click(screen.getByTitle('Pin to mood board'));- const row = await screen.findByRole('menuitemcheckbox', { name: /Refs/ });- expect(row).toHaveAttribute('aria-checked', 'true');+ const row = await screen.findByRole('button', { name: /Refs/ });+ expect(row).toHaveAttribute('aria-pressed', 'true');await act(async () => { fireEvent.click(row); });expect(api.removeMoodBoardItem).toHaveBeenCalledWith('b1', 'mbi-7', { silent: true });@@ -132,9 +132,11 @@ describe('PinToMoodBoardMenu', () => {render(<PinToMoodBoardMenu item={imageItem} />);fireEvent.click(screen.getByTitle('Pin to mood board'));- await screen.findByRole('menuitemcheckbox', { name: /Palettes/ });+ await screen.findByRole('button', { name: /Palettes/ });- expect(screen.getAllByRole('menuitemcheckbox').map((el) => el.textContent.trim()))+ // Rows are buttons inside the picker's <ul> — scoping to the list keeps+ // the trigger and create-form submit buttons out of the row order check.+ expect(within(screen.getByRole('list')).getAllByRole('button').map((el) => el.textContent.trim())).toEqual(['Universe: Refs', 'Palettes']);});@@ -153,7 +155,7 @@ describe('PinToMoodBoardMenu', () => {// Valid media-key + a protocol-relative preview: pin the key, NOT the bad URL.render(<PinToMoodBoardMenu item={{ kind: 'image', key: 'image:hero.png', previewUrl: '//evil/x.png' }} />);fireEvent.click(screen.getByTitle('Pin to mood board'));- const row = await screen.findByRole('menuitemcheckbox', { name: /Refs/ });+ const row = await screen.findByRole('button', { name: /Refs/ });await act(async () => { fireEvent.click(row); });expect(api.addMoodBoardItem).toHaveBeenCalledWith(diff --git a/client/src/components/universeBuilder/UniverseCategoryEditor.jsx b/client/src/components/universeBuilder/UniverseCategoryEditor.jsxindex 99ab577478..c6589f0451 100644--- a/client/src/components/universeBuilder/UniverseCategoryEditor.jsx+++ b/client/src/components/universeBuilder/UniverseCategoryEditor.jsx@@ -191,14 +191,17 @@ export function CategoryEditor({className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 text-port-accent hover:bg-port-accent/20 rounded"title="Move this bucket into a canon trunk (variations stay in place)"aria-label="Assign bucket to a canon trunk"- aria-haspopup="menu"aria-expanded={assignOpen}><FolderTree size={14} /></button>{assignOpen && (+ // A named group of plain buttons, NOT role="menu" — no+ // arrow-key roving focus is implemented here, so the menu+ // contract would be a lie (#7265). Tab reaches every row.<div- role="menu"+ role="group"+ aria-label="Move bucket to trunk"className="absolute right-0 top-full mt-1 z-20 w-44 bg-port-card border border-port-border rounded shadow-lg p-1 flex flex-col gap-0.5"><div className="px-2 pt-1 pb-1 text-[10px] uppercase tracking-wide text-gray-500">@@ -209,7 +212,6 @@ export function CategoryEditor({return (<buttonkey={trunk.kind}- role="menuitem"onClick={() => { setAssignOpen(false); onAssignBucketKind(trunk.kind); }}className="text-left text-xs px-2 py-1.5 text-gray-200 hover:bg-port-accent/20 rounded flex items-center gap-2">@@ -229,20 +231,22 @@ export function CategoryEditor({className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 text-port-accent hover:bg-port-accent/20 disabled:opacity-30 disabled:cursor-not-allowed rounded"title="Ask the LLM for more variations in this category"aria-label="Generate more variations"- aria-haspopup="menu"aria-expanded={genOpen}>{generating ? <Loader2 size={14} className="animate-spin" /> : <Sparkles size={14} />}</button>{genOpen && (+ // NOT role="menu" (#7265): this popover owns a number input and+ // preset buttons, which a menu may not contain, and no arrow-key+ // roving focus is implemented. A named group tells the truth.<div- role="menu"+ role="group"+ aria-label="Generate more variations"className="absolute right-0 top-full mt-1 z-20 w-44 bg-port-card border border-port-border rounded shadow-lg p-1 flex flex-col gap-0.5">{GENERATE_PRESETS.map((n) => (<buttonkey={n}- role="menuitem"onClick={() => runGenerate(n)}className="text-left text-xs px-2 py-1.5 text-gray-200 hover:bg-port-accent/20 rounded">@@ -497,7 +501,6 @@ function VariationCard({disabled={!canPromote || promotingIdx !== null}className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1 text-gray-400 hover:text-port-success disabled:opacity-30 disabled:cursor-not-allowed rounded"title={promoteTitle} aria-label={promoteTitle}- aria-haspopup={requiresTargetKind ? 'menu' : undefined}aria-expanded={requiresTargetKind ? pickerIdx === idx : undefined}>{promotingIdx === idx@@ -505,8 +508,11 @@ function VariationCard({: <ArrowUpCircle size={14} />}</button>{pickerIdx === idx && requiresTargetKind && (+ // Plain named group, not role="menu" — same reasoning as the+ // assign/generate popovers above (#7265).<div- role="menu"+ role="group"+ aria-label="Promote to canon as…"className="absolute right-0 top-full mt-1 z-20 w-44 bg-port-card border border-port-border rounded shadow-lg p-1 flex flex-col gap-0.5"><div className="px-2 pt-1 pb-1 text-[10px] uppercase tracking-wide text-gray-500">@@ -515,7 +521,6 @@ function VariationCard({{TRUNK_TABS.map((trunk) => (<buttonkey={trunk.kind}- role="menuitem"onClick={() => runPromote(idx, v, { targetKind: trunk.kind })}className="text-left text-xs px-2 py-1.5 text-gray-200 hover:bg-port-success/20 rounded">diff --git a/client/src/pages/Catalog.jsx b/client/src/pages/Catalog.jsxindex aae2782bfa..b173f6da93 100644--- a/client/src/pages/Catalog.jsx+++ b/client/src/pages/Catalog.jsx@@ -869,7 +869,6 @@ export default function Catalog() {<buttontype="button"onClick={() => { setRemixMenuOpen((o) => !o); setAddMenuOpen(false); }}- aria-haspopup="menu"aria-expanded={remixMenuOpen}aria-label="Remix into…"className="inline-flex w-full sm:w-auto items-center justify-center gap-2 px-3 py-2 min-h-[40px] rounded-lg bg-port-accent hover:bg-port-accent/90 text-white text-sm font-medium"@@ -878,15 +877,19 @@ export default function Catalog() {<span className="truncate">Remix<span className="hidden sm:inline"> into…</span></span></button>{remixMenuOpen && (+ // A plain list of actions, NOT role="menu" — that role would+ // promise ArrowUp/ArrowDown roving focus this popover doesn't+ // implement (#7265). The <ul>/<li>/<button> markup already+ // conveys "a list of actions"; aria-expanded on the trigger+ // carries the disclosure.<ul- role="menu"+ aria-label="Remix targets"className="absolute bottom-full mb-2 left-0 right-0 sm:left-auto sm:min-w-[180px] bg-port-card border border-port-border rounded-lg shadow-lg overflow-hidden">{REMIX_TARGETS.map((t) => (- <li key={t.id} role="none">+ <li key={t.id}><buttontype="button"- role="menuitem"onClick={() => handleRemix(t)}className="w-full text-left px-3 py-2 text-sm text-gray-200 hover:bg-port-bg hover:text-white">@@ -901,7 +904,6 @@ export default function Catalog() {<buttontype="button"onClick={openAddMenu}- aria-haspopup="menu"aria-expanded={addMenuOpen}aria-label="Add to universe/series…"title="Place the selected ingredients into a universe or series"@@ -914,8 +916,12 @@ export default function Catalog() {// The bar is pinned to the bottom of the viewport and the menu// opens upward, so cap it against the viewport rather than a// fixed 18rem — in landscape that would run off the top.+ // Same non-menu call as the Remix list above (#7265): a named+ // group of plain buttons, reachable by Tab — no arrow-key+ // roving focus is implemented here.<div- role="menu"+ role="group"+ aria-label="Add to universe or series"className="absolute bottom-full mb-2 left-0 right-0 sm:left-auto sm:min-w-[220px] max-h-[60vh] sm:max-h-72 overflow-y-auto bg-port-card border border-port-border rounded-lg shadow-lg">{placeTargetsLoading || placeTargets === null ? (@@ -931,7 +937,6 @@ export default function Catalog() {<buttonkey={`u-${t.refId}`}type="button"- role="menuitem"onClick={() => handleAddToRef(t.refKind, t.refId, t.label)}className="w-full text-left px-3 py-2 text-sm text-gray-200 hover:bg-port-bg hover:text-white">@@ -947,7 +952,6 @@ export default function Catalog() {<buttonkey={`s-${t.refId}`}type="button"- role="menuitem"onClick={() => handleAddToRef(t.refKind, t.refId, t.label)}className="w-full text-left px-3 py-2 text-sm text-gray-200 hover:bg-port-bg hover:text-white">diff --git a/client/src/pages/Catalog.test.jsx b/client/src/pages/Catalog.test.jsxindex 8bcaf08c67..78b4727f8a 100644--- a/client/src/pages/Catalog.test.jsx+++ b/client/src/pages/Catalog.test.jsx@@ -302,7 +302,7 @@ describe('Catalog page', () => {// Open the Remix menu and choose Story Builder.fireEvent.click(screen.getByRole('button', { name: /Remix into/i }));- fireEvent.click(await screen.findByRole('menuitem', { name: 'Story Builder' }));+ fireEvent.click(await screen.findByRole('button', { name: 'Story Builder' }));expect(navigateMock).toHaveBeenCalledWith('/story-builder', {state: { remix: { ingredientIds: ['i-1', 'i-2'] } },@@ -455,7 +455,7 @@ describe('Catalog page', () => {fireEvent.click(screen.getByRole('button', { name: /Add to universe\/series/i }));// The menu lazy-loads the full universe/series lists; wait for it to populate.- const item = await screen.findByRole('menuitem', { name: 'Echo Saints' });+ const item = await screen.findByRole('button', { name: 'Echo Saints' });await act(async () => { fireEvent.click(item); });// character → cast-character, place → cast-place.@@ -509,7 +509,7 @@ describe('Catalog page', () => {fireEvent.click(screen.getByLabelText('Select Echo Saint'));fireEvent.click(screen.getByRole('button', { name: /Add to universe\/series/i }));- expect(await screen.findByRole('menuitem', { name: 'Fresh Empty Universe' })).toBeTruthy();+ expect(await screen.findByRole('button', { name: 'Fresh Empty Universe' })).toBeTruthy();});// These buttons hide the tail of their label on a narrow viewport, so the fulldiff --git a/client/src/pages/Shell.jsx b/client/src/pages/Shell.jsxindex e85cb91e5b..1721231ac8 100644--- a/client/src/pages/Shell.jsx+++ b/client/src/pages/Shell.jsx@@ -270,7 +270,6 @@ export default function Shell() {title="cd to app folder"aria-label="cd to app folder"aria-expanded={folderDropdownOpen}- aria-haspopup="menu"><FolderOpen size={14} /><span className="hidden sm:inline">cd to app</span>diff --git a/client/src/pages/UniverseBuilder.test.jsx b/client/src/pages/UniverseBuilder.test.jsxindex 630cf97896..6ea439579c 100644--- a/client/src/pages/UniverseBuilder.test.jsx+++ b/client/src/pages/UniverseBuilder.test.jsx@@ -46,24 +46,25 @@ describe('CategoryEditor — promote wiring', () => {expect(onPromote).toHaveBeenCalledWith(sampleVariation, undefined);});- it('opens a trunk-picker menu when bucketKind is "other" instead of promoting directly', async () => {+ it('opens a trunk-picker popover when bucketKind is "other" instead of promoting directly', async () => {const onPromote = vi.fn().mockResolvedValue(undefined);const user = userEvent.setup();renderEditor({ bucketKind: null, onPromote });const promoteBtn = screen.getByRole('button', { name: /Promote to canon — pick a trunk/i });- expect(promoteBtn).toHaveAttribute('aria-haspopup', 'menu');+ // Not a menu — the popover has no arrow-key roving focus, so it claims no+ // menu contract (#7265). aria-expanded alone carries the disclosure.+ expect(promoteBtn).not.toHaveAttribute('aria-haspopup');expect(promoteBtn).toHaveAttribute('aria-expanded', 'false');await user.click(promoteBtn);expect(onPromote).not.toHaveBeenCalled();expect(promoteBtn).toHaveAttribute('aria-expanded', 'true');- const menu = screen.getByRole('menu');- expect(within(menu).getByText(/Promote to canon as/i)).toBeInTheDocument();- expect(within(menu).getByRole('menuitem', { name: 'Cast' })).toBeInTheDocument();- expect(within(menu).getByRole('menuitem', { name: 'Places' })).toBeInTheDocument();- expect(within(menu).getByRole('menuitem', { name: 'Objects' })).toBeInTheDocument();+ const picker = screen.getByRole('group', { name: /Promote to canon as/i });+ expect(within(picker).getByRole('button', { name: 'Cast' })).toBeInTheDocument();+ expect(within(picker).getByRole('button', { name: 'Places' })).toBeInTheDocument();+ expect(within(picker).getByRole('button', { name: 'Objects' })).toBeInTheDocument();});it('clicking a picker option invokes onPromote with the chosen targetKind', async () => {@@ -72,7 +73,7 @@ describe('CategoryEditor — promote wiring', () => {renderEditor({ bucketKind: null, onPromote });await user.click(screen.getByRole('button', { name: /Promote to canon — pick a trunk/i }));- await user.click(screen.getByRole('menuitem', { name: 'Places' }));+ await user.click(screen.getByRole('button', { name: 'Places' }));expect(onPromote).toHaveBeenCalledTimes(1);expect(onPromote).toHaveBeenCalledWith(sampleVariation, { targetKind: 'places' });