Skip to content
Snippets Groups Projects
Unverified Commit b1770a5e authored by Carter Temm's avatar Carter Temm Committed by GitHub
Browse files

[BUG]: Many controls lack screen reader labels (#1023)

* Add accessible labels for back and continue buttons in onboarding flow

* Add accessible label to stop generating button

* Accessible labels for chat history actions (thumb up/down and copy)

* Accessible labels for social links in footer

* Accessible labels for home and settings links

* * Accessible labels for home, show sidebar (mobile), and workspace and thread lists.

* Implemented ARIA markup to programmatically indicate current selection and group/list association.
parent 718062d0
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,7 @@ export default function Footer() { ...@@ -52,6 +52,7 @@ export default function Footer() {
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border" className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border"
aria-label="Find us on Github"
> >
<GithubLogo weight="fill" className="h-5 w-5 " /> <GithubLogo weight="fill" className="h-5 w-5 " />
</a> </a>
...@@ -60,6 +61,7 @@ export default function Footer() { ...@@ -60,6 +61,7 @@ export default function Footer() {
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border" className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border"
aria-label="Docs"
> >
<BookOpen weight="fill" className="h-5 w-5 " /> <BookOpen weight="fill" className="h-5 w-5 " />
</a> </a>
...@@ -68,6 +70,7 @@ export default function Footer() { ...@@ -68,6 +70,7 @@ export default function Footer() {
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border" className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border"
aria-label="Join our Discord server"
> >
<DiscordLogo <DiscordLogo
weight="fill" weight="fill"
......
...@@ -15,6 +15,7 @@ export default function SettingsButton() { ...@@ -15,6 +15,7 @@ export default function SettingsButton() {
<Link <Link
to={paths.home()} to={paths.home()}
className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border" className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border"
aria-label="Home"
> >
<ArrowUUpLeft className="h-5 w-5" weight="fill" /> <ArrowUUpLeft className="h-5 w-5" weight="fill" />
</Link> </Link>
...@@ -24,6 +25,7 @@ export default function SettingsButton() { ...@@ -24,6 +25,7 @@ export default function SettingsButton() {
<Link <Link
to={!!user?.role ? paths.settings.system() : paths.settings.appearance()} to={!!user?.role ? paths.settings.system() : paths.settings.appearance()}
className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border" className="transition-all duration-300 p-2 rounded-full text-white bg-sidebar-button hover:bg-menu-item-selected-gradient hover:border-slate-100 hover:border-opacity-50 border-transparent border"
aria-label="Settings"
> >
<Wrench className="h-5 w-5" weight="fill" /> <Wrench className="h-5 w-5" weight="fill" />
</Link> </Link>
......
...@@ -25,7 +25,10 @@ export default function ThreadItem({ ...@@ -25,7 +25,10 @@ export default function ThreadItem({
: paths.workspace.thread(slug, thread.slug); : paths.workspace.thread(slug, thread.slug);
return ( return (
<div className="w-full relative flex h-[38px] items-center border-none hover:bg-slate-600/20 rounded-lg"> <div
className="w-full relative flex h-[38px] items-center border-none hover:bg-slate-600/20 rounded-lg"
role="listitem"
>
{/* Curved line Element and leader if required */} {/* Curved line Element and leader if required */}
<div <div
style={{ width: THREAD_CALLOUT_DETAIL_WIDTH / 2 }} style={{ width: THREAD_CALLOUT_DETAIL_WIDTH / 2 }}
...@@ -63,6 +66,7 @@ export default function ThreadItem({ ...@@ -63,6 +66,7 @@ export default function ThreadItem({
<a <a
href={window.location.pathname === linkTo ? "#" : linkTo} href={window.location.pathname === linkTo ? "#" : linkTo}
className="w-full" className="w-full"
aria-current={isActive ? "page" : ""}
> >
<p <p
className={`text-left text-sm ${ className={`text-left text-sm ${
...@@ -79,6 +83,7 @@ export default function ThreadItem({ ...@@ -79,6 +83,7 @@ export default function ThreadItem({
<button <button
type="button" type="button"
onClick={() => setShowOptions(!showOptions)} onClick={() => setShowOptions(!showOptions)}
aria-label="Thread options"
> >
<DotsThree className="text-slate-300" size={25} /> <DotsThree className="text-slate-300" size={25} />
</button> </button>
......
...@@ -46,7 +46,7 @@ export default function ThreadContainer({ workspace }) { ...@@ -46,7 +46,7 @@ export default function ThreadContainer({ workspace }) {
? threads.findIndex((thread) => thread?.slug === threadSlug) + 1 ? threads.findIndex((thread) => thread?.slug === threadSlug) + 1
: 0; : 0;
return ( return (
<div className="flex flex-col"> <div className="flex flex-col" role="list" aria-label="Threads">
<ThreadItem <ThreadItem
idx={0} idx={0}
activeIdx={activeThreadIdx} activeIdx={activeThreadIdx}
......
...@@ -72,7 +72,7 @@ export default function ActiveWorkspaces() { ...@@ -72,7 +72,7 @@ export default function ActiveWorkspaces() {
} }
return ( return (
<> <div role="list" aria-label="Workspaces">
{workspaces.map((workspace) => { {workspaces.map((workspace) => {
const isActive = workspace.slug === slug; const isActive = workspace.slug === slug;
const isHovered = hoverStates[workspace.id]; const isHovered = hoverStates[workspace.id];
...@@ -82,6 +82,7 @@ export default function ActiveWorkspaces() { ...@@ -82,6 +82,7 @@ export default function ActiveWorkspaces() {
onMouseEnter={() => handleMouseEnter(workspace.id)} onMouseEnter={() => handleMouseEnter(workspace.id)}
onMouseLeave={() => handleMouseLeave(workspace.id)} onMouseLeave={() => handleMouseLeave(workspace.id)}
key={workspace.id} key={workspace.id}
role="listitem"
> >
<div <div
key={workspace.id} key={workspace.id}
...@@ -89,6 +90,7 @@ export default function ActiveWorkspaces() { ...@@ -89,6 +90,7 @@ export default function ActiveWorkspaces() {
> >
<a <a
href={isActive ? null : paths.workspace.chat(workspace.slug)} href={isActive ? null : paths.workspace.chat(workspace.slug)}
aria-current={isActive ? "page" : ""}
className={` className={`
transition-all duration-[200ms] transition-all duration-[200ms]
flex flex-grow w-[75%] gap-x-2 py-[6px] px-[12px] rounded-[4px] text-white justify-start items-center flex flex-grow w-[75%] gap-x-2 py-[6px] px-[12px] rounded-[4px] text-white justify-start items-center
...@@ -154,6 +156,7 @@ export default function ActiveWorkspaces() { ...@@ -154,6 +156,7 @@ export default function ActiveWorkspaces() {
onMouseEnter={() => handleGearMouseEnter(workspace.id)} onMouseEnter={() => handleGearMouseEnter(workspace.id)}
onMouseLeave={() => handleGearMouseLeave(workspace.id)} onMouseLeave={() => handleGearMouseLeave(workspace.id)}
className="rounded-md flex items-center justify-center text-[#A7A8A9] hover:text-white ml-auto" className="rounded-md flex items-center justify-center text-[#A7A8A9] hover:text-white ml-auto"
aria-label="General appearance settings"
> >
<div className="flex hover:bg-[#646768] p-[2px] rounded-[4px]"> <div className="flex hover:bg-[#646768] p-[2px] rounded-[4px]">
<GearSix <GearSix
...@@ -186,6 +189,6 @@ export default function ActiveWorkspaces() { ...@@ -186,6 +189,6 @@ export default function ActiveWorkspaces() {
providedSlug={selectedWs ? selectedWs.slug : null} providedSlug={selectedWs ? selectedWs.slug : null}
/> />
)} )}
</> </div>
); );
} }
...@@ -27,6 +27,7 @@ export default function Sidebar() { ...@@ -27,6 +27,7 @@ export default function Sidebar() {
<Link <Link
to={paths.home()} to={paths.home()}
className="flex shrink-0 max-w-[55%] items-center justify-start mx-[38px] my-[18px]" className="flex shrink-0 max-w-[55%] items-center justify-start mx-[38px] my-[18px]"
aria-label="Home"
> >
<img <img
src={logo} src={logo}
...@@ -104,6 +105,7 @@ export function SidebarMobileHeader() { ...@@ -104,6 +105,7 @@ export function SidebarMobileHeader() {
className="rounded-md p-2 flex items-center justify-center text-slate-200" className="rounded-md p-2 flex items-center justify-center text-slate-200"
> >
<List className="h-6 w-6" /> <List className="h-6 w-6" />
aria-label="Show sidebar"
</button> </button>
<div className="flex items-center justify-center flex-grow"> <div className="flex items-center justify-center flex-grow">
<img <img
......
...@@ -58,6 +58,7 @@ function FeedbackButton({ ...@@ -58,6 +58,7 @@ function FeedbackButton({
data-tooltip-id={tooltipId} data-tooltip-id={tooltipId}
data-tooltip-content={tooltipContent} data-tooltip-content={tooltipContent}
className="text-zinc-300" className="text-zinc-300"
aria-label={tooltipContent}
> >
<IconComponent <IconComponent
size={18} size={18}
...@@ -86,6 +87,7 @@ function CopyMessage({ message }) { ...@@ -86,6 +87,7 @@ function CopyMessage({ message }) {
data-tooltip-id="copy-assistant-text" data-tooltip-id="copy-assistant-text"
data-tooltip-content="Copy" data-tooltip-content="Copy"
className="text-zinc-300" className="text-zinc-300"
aria-label="Copy"
> >
{copied ? ( {copied ? (
<Check size={18} className="mb-1" /> <Check size={18} className="mb-1" />
......
...@@ -14,6 +14,7 @@ export default function StopGenerationButton() { ...@@ -14,6 +14,7 @@ export default function StopGenerationButton() {
data-tooltip-id="stop-generation-button" data-tooltip-id="stop-generation-button"
data-tooltip-content="Stop generating response" data-tooltip-content="Stop generating response"
className="border-none text-white/60 cursor-pointer group" className="border-none text-white/60 cursor-pointer group"
aria-label="Stop generating"
> >
<svg <svg
width="28" width="28"
......
...@@ -100,6 +100,7 @@ export function OnboardingLayout({ children }) { ...@@ -100,6 +100,7 @@ export function OnboardingLayout({ children }) {
disabled={backBtn.disabled} disabled={backBtn.disabled}
onClick={backBtn.onClick} onClick={backBtn.onClick}
className="group p-2 rounded-lg border-2 border-zinc-300 disabled:border-zinc-600 h-fit w-fit disabled:not-allowed hover:bg-zinc-100 disabled:hover:bg-transparent" className="group p-2 rounded-lg border-2 border-zinc-300 disabled:border-zinc-600 h-fit w-fit disabled:not-allowed hover:bg-zinc-100 disabled:hover:bg-transparent"
aria-label="Back"
> >
<ArrowLeft <ArrowLeft
className="text-white group-hover:text-black group-disabled:text-gray-500" className="text-white group-hover:text-black group-disabled:text-gray-500"
...@@ -127,6 +128,7 @@ export function OnboardingLayout({ children }) { ...@@ -127,6 +128,7 @@ export function OnboardingLayout({ children }) {
disabled={forwardBtn.disabled} disabled={forwardBtn.disabled}
onClick={forwardBtn.onClick} onClick={forwardBtn.onClick}
className="group p-2 rounded-lg border-2 border-zinc-300 disabled:border-zinc-600 h-fit w-fit disabled:not-allowed hover:bg-zinc-100 disabled:hover:bg-transparent" className="group p-2 rounded-lg border-2 border-zinc-300 disabled:border-zinc-600 h-fit w-fit disabled:not-allowed hover:bg-zinc-100 disabled:hover:bg-transparent"
aria-label="Continue"
> >
<ArrowRight <ArrowRight
className="text-white group-hover:text-black group-disabled:text-gray-500" className="text-white group-hover:text-black group-disabled:text-gray-500"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment