Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix command palette active option accessibility

pulse-triage[bot]23a59f17a1db
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index a7ded1465d..59fbc9fb09 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -4683,6 +4683,11 @@ route-path wiring, and command selection, and
owns canonical command construction plus query normalization and filtering
policy. Future command-palette work should extend those owners instead of
pushing route construction or search policy back into the shared shell.
+The palette search composes `SearchField` as an editable list-autocomplete
+combobox: DOM focus remains on the search input while arrow-key selection is
+exposed through `aria-activedescendant`, and the active listbox option remains
+scrolled into view. Palette options stay outside the Tab sequence; filtering
+to an empty result collapses the combobox and clears its active descendant.
The OpenCode reference for this interaction is
`packages/opencode/src/cli/cmd/run/footer.command.tsx` at `origin/dev`
`e82542b8023a8374f29c23b70ec019c8f256354e`, where `RunCommandMenuBody`
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 18f17f0119..7dba434b29 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,13 +1,21 @@
{
"version": 1,
- "base_sha": "77bf2a27c6551ce58c31569df607c5ce4ae11825",
- "verified_at": "2026-09-02T06:10:16Z",
+ "base_sha": "23b3893ae88b86497f3f103c8972663508555766",
+ "verified_at": "2026-09-02T07:15:12Z",
"result": "passed",
- "changed_paths": ["frontend-modern/src/components/Settings/DiscoverySettingsForm.tsx"],
+ "changed_paths": [
+ "frontend-modern/src/components/shared/CommandPaletteModal.tsx",
+ "frontend-modern/src/components/shared/SearchField.tsx",
+ "frontend-modern/src/components/shared/searchFieldModel.ts",
+ "frontend-modern/src/components/shared/useCommandPaletteState.ts"
+ ],
"content_sha256": {
- "frontend-modern/src/components/Settings/DiscoverySettingsForm.tsx": "a9f3c0dc82e639d9e6fa283cd3ef9b071d322b43bcefb2e760d8ce7e43eeb3bb"
+ "frontend-modern/src/components/shared/CommandPaletteModal.tsx": "300030975b76634513d98b9459fe9ae4d07e8d7d03fedffa91f702746a7d3f06",
+ "frontend-modern/src/components/shared/SearchField.tsx": "0c2cc0d002763b59c2c065ceccff134318122aa975fe45ddc31271387cd623ad",
+ "frontend-modern/src/components/shared/searchFieldModel.ts": "3b9ca4ffc6aef0e5910e5094daebb9b03878b2b6ef4c9c7aed165bf7f46097db",
+ "frontend-modern/src/components/shared/useCommandPaletteState.ts": "df4baf2ccba420f0c8d7d67ee7ddeba5a55ddbee8af323d8d7924aa389ad9b3a"
},
- "routes": ["/settings/infrastructure"],
+ "routes": ["/proxmox"],
"viewports": [
{
"width": 1280,
@@ -19,13 +27,16 @@
}
],
"states": [
- "Discovery settings dialog open with Automatic scan selected at desktop and phone widths",
- "Discovery settings dialog open with Custom subnets selected and keyboard focus retained on that radio at desktop and phone widths"
+ "Command palette open with twelve results and the first result selected at desktop and narrow widths",
+ "Command palette scrolled to the last keyboard-selected result at desktop and narrow widths",
+ "Command palette empty result state after a query with no matching commands at desktop and narrow widths",
+ "Command palette closed after Escape and after backdrop dismissal at desktop and narrow widths"
],
"interactions": [
- "opened Discovery settings from the authenticated Infrastructure discovery band at desktop and phone widths",
- "focused Automatic scan and pressed ArrowDown to select Custom subnets",
- "verified focus stayed on Custom subnets after production subnet-field autofocus ran",
- "verified aria-checked and the single roving tab stop moved from Automatic scan to Custom subnets"
+ "opened the command palette with Control+K on the authenticated Proxmox route",
+ "verified the search retained DOM focus while pointer hover and Home and End keys updated aria-activedescendant and aria-selected",
+ "verified End scrolled the last selected option fully into the result viewport and Tab did not focus an option",
+ "entered a no-match query and verified the combobox collapsed, cleared its active descendant, and removed the listbox",
+ "dismissed the palette with Escape and reopened and dismissed it through the backdrop"
]
}
diff --git a/frontend-modern/src/components/shared/CommandPaletteModal.tsx b/frontend-modern/src/components/shared/CommandPaletteModal.tsx
index 60a5b7e552..28fc4355f4 100644
--- a/frontend-modern/src/components/shared/CommandPaletteModal.tsx
+++ b/frontend-modern/src/components/shared/CommandPaletteModal.tsx
@@ -9,9 +9,17 @@ import {
export type { CommandPaletteModalProps } from './useCommandPaletteState';
+const COMMAND_PALETTE_RESULTS_ID = 'command-palette-results';
+const getCommandPaletteOptionId = (commandId: string) => `command-palette-option-${commandId}`;
+
export function CommandPaletteModal(props: CommandPaletteModalProps) {
const commandPalette = useCommandPaletteState(props);
+ const activeOptionId = () => {
+ const command = commandPalette.filteredCommands()[commandPalette.selectedIndex()];
+ return command ? getCommandPaletteOptionId(command.id) : undefined;
+ };
+
const handleSelect = (command: CommandPaletteModalCommand) => {
commandPalette.handleSelect(command);
};
@@ -34,6 +42,11 @@ export function CommandPaletteModal(props: CommandPaletteModalProps) {
inputClass="bg-base"
clearOnFocusedEscape={false}
shortcutHint="Cmd+K"
+ role="combobox"
+ ariaAutocomplete="list"
+ ariaControls={COMMAND_PALETTE_RESULTS_ID}
+ ariaExpanded={commandPalette.filteredCommands().length > 0}
+ ariaActiveDescendant={activeOptionId()}
/>
</div>
@@ -42,15 +55,22 @@ export function CommandPaletteModal(props: CommandPaletteModalProps) {
when={commandPalette.filteredCommands().length > 0}
fallback={<div class="px-3 py-8 text-center text-sm text-muted">No matches found.</div>}
>
- <div role="listbox" aria-label="Command palette results">
+ <div
+ ref={commandPalette.setListboxRef}
+ id={COMMAND_PALETTE_RESULTS_ID}
+ role="listbox"
+ aria-label="Command palette results"
+ >
<For each={commandPalette.filteredCommands()}>
{(command, index) => {
const selected = () => commandPalette.selectedIndex() === index();
return (
<button
type="button"
+ id={getCommandPaletteOptionId(command.id)}
role="option"
aria-selected={selected()}
+ tabIndex={-1}
class={`flex w-full items-center justify-between rounded-md px-3 py-2 text-left text-sm text-base-content outline-none transition-colors hover:bg-surface-hover focus:bg-surface-hover ${
selected() ? 'bg-surface-hover' : ''
}`}
diff --git a/frontend-modern/src/components/shared/SearchField.tsx b/frontend-modern/src/components/shared/SearchField.tsx
index 7075db4237..6f4ebb1467 100644
--- a/frontend-modern/src/components/shared/SearchField.tsx
+++ b/frontend-modern/src/components/shared/SearchField.tsx
@@ -23,6 +23,9 @@ export const SearchField: Component<SearchFieldProps> = (props) => {
aria-label={props.title ?? props.placeholder ?? 'Search'}
role={props.role}
aria-autocomplete={props.ariaAutocomplete}
+ aria-controls={props.ariaControls}
+ aria-expanded={props.ariaExpanded}
+ aria-activedescendant={props.ariaActiveDescendant}
class={`min-h-11 w-full pl-8 sm:min-h-10 sm:pl-9 ${search.inputPaddingRight()} py-1.5 sm:py-2 text-sm border border-border rounded-md
bg-surface text-base-content placeholder-muted
focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:focus:border-blue-400 outline-none transition-all disabled:opacity-60 disabled:cursor-not-allowed ${props.inputClass ?? ''}`}
diff --git a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
index c2896ceee2..f82bf9db48 100644
--- a/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/CommandPaletteModal.test.tsx
@@ -157,17 +157,21 @@ describe('CommandPaletteModal', () => {
));
const input = screen.getByPlaceholderText('Type a command or search...');
- expect(screen.getByRole('option', { name: /Ask about Proxmox/ })).toHaveAttribute(
- 'aria-selected',
- 'true',
- );
+ const firstOption = screen.getByRole('option', { name: /Ask about Proxmox/ });
+ expect(input).toHaveAttribute('role', 'combobox');
+ expect(input).toHaveAttribute('aria-autocomplete', 'list');
+ expect(input).toHaveAttribute('aria-controls', 'command-palette-results');
+ expect(input).toHaveAttribute('aria-expanded', 'true');
+ expect(firstOption).toHaveAttribute('aria-selected', 'true');
+ expect(firstOption).toHaveAttribute('tabindex', '-1');
+ expect(input).toHaveAttribute('aria-activedescendant', firstOption.id);
await fireEvent.keyDown(input, { key: 'ArrowDown' });
- expect(screen.getByRole('option', { name: /Show Assistant commands/ })).toHaveAttribute(
- 'aria-selected',
- 'true',
- );
+ const secondOption = screen.getByRole('option', { name: /Show Assistant commands/ });
+ expect(secondOption).toHaveAttribute('aria-selected', 'true');
+ expect(input).toHaveFocus();
+ expect(input).toHaveAttribute('aria-activedescendant', secondOption.id);
await fireEvent.keyDown(input, { key: 'Enter' });
@@ -178,6 +182,48 @@ describe('CommandPaletteModal', () => {
expect(openAssistant).not.toHaveBeenCalled();
});
+ it('keeps the active command visible while keyboard focus remains on the combobox', async () => {
+ render(() => (
+ <CommandPaletteModal
+ isOpen={true}
+ onClose={vi.fn()}
+ platformVisibility={platformVisibility}
+ />
+ ));
+
+ const input = screen.getByRole('combobox', { name: 'Type a command or search...' });
+ const secondOption = screen.getByRole('option', { name: /Show Assistant commands/ });
+ const scrollIntoView = vi.fn();
+ Object.defineProperty(secondOption, 'scrollIntoView', {
+ configurable: true,
+ value: scrollIntoView,
+ });
+
+ input.focus();
+ fireEvent.keyDown(input, { key: 'ArrowDown' });
+
+ await waitFor(() => expect(scrollIntoView).toHaveBeenCalledWith({ block: 'nearest' }));
+ expect(input).toHaveFocus();
+ });
+
+ it('clears active-option semantics when filtering produces no matches', async () => {
+ render(() => (
+ <CommandPaletteModal
+ isOpen={true}
+ onClose={vi.fn()}
+ platformVisibility={platformVisibility}
+ />
+ ));
+
+ const input = screen.getByRole('combobox', { name: 'Type a command or search...' });
+ fireEvent.input(input, { target: { value: 'definitely-no-command-matches-this' } });
+
+ await waitFor(() => expect(screen.getByText('No matches found.')).toBeInTheDocument());
+ expect(input).toHaveAttribute('aria-expanded', 'false');
+ expect(input).not.toHaveAttribute('aria-activedescendant');
+ expect(screen.queryByRole('listbox')).toBeNull();
+ });
+
it('keeps the selected command across command-list recomputes before Enter selection', async () => {
const onClose = vi.fn();
const openAssistant = vi.spyOn(aiChatStore, 'open').mockImplementation(() => {});
diff --git a/frontend-modern/src/components/shared/__tests__/SearchField.test.tsx b/frontend-modern/src/components/shared/__tests__/SearchField.test.tsx
index cf09f09e6b..b992f707ee 100644
--- a/frontend-modern/src/components/shared/__tests__/SearchField.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/SearchField.test.tsx
@@ -42,6 +42,27 @@ describe('SearchField', () => {
expect(screen.getByPlaceholderText('Search field')).toHaveClass('sm:min-h-10');
});
+ it('forwards combobox ownership and active-option semantics', () => {
+ render(() => (
+ <SearchField
+ value=""
+ onChange={vi.fn()}
+ placeholder="Command search"
+ role="combobox"
+ ariaAutocomplete="list"
+ ariaControls="command-results"
+ ariaExpanded={true}
+ ariaActiveDescendant="command-result-active"
+ />
+ ));
+
+ const input = screen.getByRole('combobox', { name: 'Command search' });
+ expect(input).toHaveAttribute('aria-autocomplete', 'list');
+ expect(input).toHaveAttribute('aria-controls', 'command-results');
+ expect(input).toHaveAttribute('aria-expanded', 'true');
+ expect(input).toHaveAttribute('aria-activedescendant', 'command-result-active');
+ });
+
it('reserves mobile input space for every visible trailing action', () => {
expect(
getSearchFieldInputPaddingRightClass({
diff --git a/frontend-modern/src/components/shared/searchFieldModel.ts b/frontend-modern/src/components/shared/searchFieldModel.ts
index ff59ef7f40..56d3d1702d 100644
--- a/frontend-modern/src/components/shared/searchFieldModel.ts
+++ b/frontend-modern/src/components/shared/searchFieldModel.ts
@@ -38,6 +38,9 @@ export interface SearchFieldProps {
completionSuffix?: string;
role?: JSX.InputHTMLAttributes<HTMLInputElement>['role'];
ariaAutocomplete?: JSX.AriaAttributes['aria-autocomplete'];
+ ariaControls?: JSX.AriaAttributes['aria-controls'];
+ ariaExpanded?: JSX.AriaAttributes['aria-expanded'];
+ ariaActiveDescendant?: JSX.AriaAttributes['aria-activedescendant'];
}
export const shouldShowSearchFieldShortcutHint = (value: string, shortcutHint?: string) =>
diff --git a/frontend-modern/src/components/shared/useCommandPaletteState.ts b/frontend-modern/src/components/shared/useCommandPaletteState.ts
index 9f13fbdb98..29f5aded78 100644
--- a/frontend-modern/src/components/shared/useCommandPaletteState.ts
+++ b/frontend-modern/src/components/shared/useCommandPaletteState.ts
@@ -28,6 +28,7 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) {
const location = useLocation();
const [query, setQuery] = createSignal('');
const [inputRef, setInputRef] = createSignal<HTMLInputElement>();
+ const [listboxRef, setListboxRef] = createSignal<HTMLDivElement>();
const [selectedIndex, setSelectedIndex] = createSignal(0);
const assistantPageContext = createMemo(() => getAssistantPageContext(location.pathname));
@@ -128,6 +129,16 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) {
setSelectedIndex((index) => (total > 0 ? Math.min(index, total - 1) : 0));
});
+ createEffect(() => {
+ selectedIndex();
+ filteredCommands();
+ queueMicrotask(() => {
+ listboxRef()
+ ?.querySelector<HTMLElement>('[role="option"][aria-selected="true"]')
+ ?.scrollIntoView?.({ block: 'nearest' });
+ });
+ });
+
createEffect(() => {
if (props.isOpen) {
setQuery('');
@@ -148,6 +159,7 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) {
selectedIndex,
setSelectedIndex,
setInputRef,
+ setListboxRef,
setQuery,
};
}