Skip to content

The Open Standard for Generative UI

fix(a11y): add aria-labels to icon-only buttons in Shell components (#475)

Olabode Felix Akinyemi8ffd1f47e34d
diff --git a/packages/react-ui/src/components/CopilotShell/components/Composer.tsx b/packages/react-ui/src/components/CopilotShell/components/Composer.tsx
index dfa225135..c1ee67680 100644
--- a/packages/react-ui/src/components/CopilotShell/components/Composer.tsx
+++ b/packages/react-ui/src/components/CopilotShell/components/Composer.tsx
@@ -70,6 +70,7 @@ export const Composer = ({ className, placeholder = "Type your message..." }: Co
icon={isRunning ? <Square size="1em" fill="currentColor" /> : <ArrowUp size="1em" />}
size="medium"
variant="primary"
+ aria-label={isRunning ? "Cancel message" : "Send message"}
className="openui-copilot-shell-thread-composer__submit-button"
/>
</div>
diff --git a/packages/react-ui/src/components/Shell/MobileHeader.tsx b/packages/react-ui/src/components/Shell/MobileHeader.tsx
index 16596285f..cb67585b5 100644
--- a/packages/react-ui/src/components/Shell/MobileHeader.tsx
+++ b/packages/react-ui/src/components/Shell/MobileHeader.tsx
@@ -25,6 +25,7 @@ export const MobileHeader = ({ className, rightChildren }: MobileHeaderProps) =>
icon={<Menu size="1em" />}
onClick={() => setIsSidebarOpen(true)}
variant="secondary"
+ aria-label="Open sidebar"
/>
<div className="openui-shell-mobile-header-logo-container">
<img className="openui-shell-mobile-header-logo" src={logoUrl} alt="Logo" />
@@ -37,6 +38,7 @@ export const MobileHeader = ({ className, rightChildren }: MobileHeaderProps) =>
icon={<Plus size="1em" />}
onClick={switchToNewThread}
variant="secondary"
+ aria-label="New chat"
/>
</div>
</div>
diff --git a/packages/react-ui/src/components/Shell/NewChatButton.tsx b/packages/react-ui/src/components/Shell/NewChatButton.tsx
index a17ef7067..b4dee9a27 100644
--- a/packages/react-ui/src/components/Shell/NewChatButton.tsx
+++ b/packages/react-ui/src/components/Shell/NewChatButton.tsx
@@ -18,6 +18,7 @@ export const NewChatButton = ({ className }: { className?: string }) => {
onClick={switchToNewThread}
variant="primary"
size="small"
+ aria-label="New chat"
className={clsx("openui-shell-new-chat-button_collapsed", className)}
/>
);
diff --git a/packages/react-ui/src/components/Shell/Sidebar.tsx b/packages/react-ui/src/components/Shell/Sidebar.tsx
index 9cde32be7..960162e04 100644
--- a/packages/react-ui/src/components/Shell/Sidebar.tsx
+++ b/packages/react-ui/src/components/Shell/Sidebar.tsx
@@ -91,6 +91,7 @@ export const SidebarHeader = ({
}}
size="small"
variant="secondary"
+ aria-label={isSidebarOpen ? "Collapse sidebar" : "Expand sidebar"}
className="openui-shell-sidebar-header__toggle-button"
/>
</div>
diff --git a/packages/react-ui/src/components/Shell/components/Composer.tsx b/packages/react-ui/src/components/Shell/components/Composer.tsx
index b141a0e83..4ccd958f8 100644
--- a/packages/react-ui/src/components/Shell/components/Composer.tsx
+++ b/packages/react-ui/src/components/Shell/components/Composer.tsx
@@ -70,6 +70,7 @@ export const Composer = ({ className, placeholder = "Type your query here" }: Co
icon={isRunning ? <Square size="1em" fill="currentColor" /> : <ArrowUp size="1em" />}
size="medium"
variant="primary"
+ aria-label={isRunning ? "Cancel message" : "Send message"}
className="openui-shell-thread-composer__submit-button"
/>
</div>