Skip to content

Commit 2cb4003

Browse files
fix(web): screen readers hear the add-project submit shortcut
The Add project folder browse, clone, and New project steps show their submit action and shortcut only on a tabIndex=-1 button beside the input, so screen reader users in focus mode never hear how to submit. Give the submit button a stable id and point the palette input's aria-describedby at it whenever the button is rendered. The button's aria-label, which already tracks the highlighted row, becomes the input's description. Other palette views render no button and get no description. Fixes #32567 AI-assisted; verified with the tests and tools listed above.
1 parent fe59342 commit 2cb4003

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎apps/web/src/components/CommandPalette.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ import { openThreadFind } from "./chat/threadFindStore";
8181
import {
8282
useDeferredValue,
8383
useEffect,
84+
useId,
8485
useReducer,
8586
useRef,
8687
useState,
@@ -2747,9 +2748,11 @@ function OpenCommandPaletteDialog(props: {
27472748
await handleAddProject(pickedPath);
27482749
};
27492750

2751+
const submitButtonId = useId();
27502752
const inputAccessory =
27512753
newProjectFlow !== null ? (
27522754
<CommandPaletteSubmitButton
2755+
id={submitButtonId}
27532756
label={isCreatingNewProject ? "Creating" : "Create"}
27542757
shortcutLabel={createShortcutLabel}
27552758
ariaLabel={`Create (${createShortcutLabel})`}
@@ -2761,6 +2764,7 @@ function OpenCommandPaletteDialog(props: {
27612764
/>
27622765
) : addProjectCloneFlow?.step === "repository" ? (
27632766
<CommandPaletteSubmitButton
2767+
id={submitButtonId}
27642768
label={isRemoteProjectPending ? "Working" : remoteProjectButtonLabel}
27652769
shortcutLabel="Enter"
27662770
ariaLabel={`${remoteProjectButtonLabel ?? "Continue"} (Enter)`}
@@ -2772,6 +2776,7 @@ function OpenCommandPaletteDialog(props: {
27722776
/>
27732777
) : isBrowsing ? (
27742778
<CommandPaletteSubmitButton
2779+
id={submitButtonId}
27752780
label={isCloneDestinationStep && isRemoteProjectPending ? "Cloning" : submitActionLabel}
27762781
shortcutLabel={addShortcutLabel}
27772782
ariaLabel={`${submitActionLabel} (${addShortcutLabel})`}
@@ -2849,6 +2854,7 @@ function OpenCommandPaletteDialog(props: {
28492854
})
28502855
: undefined,
28512856
placeholder: inputPlaceholder,
2857+
"aria-describedby": inputAccessory ? submitButtonId : undefined,
28522858
...(isSubmenu
28532859
? {
28542860
startAddon: (

‎apps/web/src/components/CommandPaletteAddProject.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export function sourceControlHostIcon(
3434

3535
/** The input's trailing submit button for the add-project, clone, and new-project flows. */
3636
export function CommandPaletteSubmitButton(props: {
37+
readonly id: string;
3738
readonly label: ReactNode;
3839
readonly shortcutLabel: string;
3940
readonly ariaLabel: string;
@@ -46,6 +47,7 @@ export function CommandPaletteSubmitButton(props: {
4647
<TooltipTrigger
4748
render={
4849
<Button
50+
id={props.id}
4951
variant="outline"
5052
size="xs"
5153
tabIndex={-1}

0 commit comments

Comments
 (0)