Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): describe search command dialog (#13675)

zcxGGmuf5d15e243b78
diff --git a/autogpt_platform/frontend/src/components/organisms/SearchCommandModal/SearchCommandModal.tsx b/autogpt_platform/frontend/src/components/organisms/SearchCommandModal/SearchCommandModal.tsx
index ec0c94fe7b..5a0a70991d 100644
--- a/autogpt_platform/frontend/src/components/organisms/SearchCommandModal/SearchCommandModal.tsx
+++ b/autogpt_platform/frontend/src/components/organisms/SearchCommandModal/SearchCommandModal.tsx
@@ -122,6 +122,9 @@ export function SearchCommandModal({
onKeyDown={handleKeyDown}
>
<RXDialog.Title className="sr-only">Search</RXDialog.Title>
+ <RXDialog.Description className="sr-only">
+ Search commands and results.
+ </RXDialog.Description>
<div className="flex items-center gap-3 bg-zinc-50 p-3">
<MagnifyingGlassIcon className="h-5 w-5 shrink-0 text-zinc-800" />
<Input
diff --git a/autogpt_platform/frontend/src/components/organisms/SearchCommandModal/__tests__/SearchCommandModal.accessibility.test.tsx b/autogpt_platform/frontend/src/components/organisms/SearchCommandModal/__tests__/SearchCommandModal.accessibility.test.tsx
new file mode 100644
index 0000000000..04f8ed8e60
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/SearchCommandModal/__tests__/SearchCommandModal.accessibility.test.tsx
@@ -0,0 +1,26 @@
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import { SearchCommandModal } from "../SearchCommandModal";
+
+describe("SearchCommandModal accessibility", () => {
+ it("describes the dialog content for assistive technology", () => {
+ render(
+ <SearchCommandModal
+ isOpen
+ onClose={vi.fn()}
+ query=""
+ onQueryChange={vi.fn()}
+ buckets={[]}
+ onSelectItem={vi.fn()}
+ />,
+ );
+
+ const dialog = screen.getByRole("dialog", { name: "Search" });
+ const descriptionId = dialog.getAttribute("aria-describedby");
+
+ expect(descriptionId).toBeTruthy();
+ expect(document.getElementById(descriptionId ?? "")?.textContent).toBe(
+ "Search commands and results.",
+ );
+ });
+});