GeezerVison is showing github.com — fix(app): session screen accessibility improvements (#9907) · bewareoftheleopard/opencode@3435327
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-connect-provider.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -143,7 +143,7 @@ export function DialogConnectProvider(props: { provider: string }) { | 143 | 143 | } | 144 | 144 |
| 145 | 145 | return ( | 146 | | - <Dialog title={<IconButton tabIndex={-1} icon="arrow-left" variant="ghost" onClick={goBack} />}> | | 146 | + <Dialog title={<IconButton tabIndex={-1} icon="arrow-left" variant="ghost" onClick={goBack} aria-label="Go back" />}> | 147 | 147 | <div class="flex flex-col gap-6 px-2.5 pb-3"> | 148 | 148 | <div class="px-2.5 flex gap-4 items-center"> | 149 | 149 | <ProviderIcon id={props.provider as IconName} class="size-5 shrink-0 icon-strong-base" /> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-edit-project.tsx +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -193,6 +193,8 @@ export function DialogEditProject(props: { project: LocalProject }) { | 193 | 193 | {(color) => ( | 194 | 194 | <button | 195 | 195 | type="button" | | 196 | + aria-label={`Select ${color} color`} | | 197 | + aria-pressed={store.color === color} | 196 | 198 | classList={{ | 197 | 199 | "flex items-center justify-center size-10 p-0.5 rounded-lg overflow-hidden transition-colors cursor-default": true, | 198 | 200 | "bg-transparent border-2 border-icon-strong-base hover:bg-surface-base-hover": | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-select-model.tsx +9-5Lines changed: 9 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { Popover as Kobalte } from "@kobalte/core/popover" | 2 | | -import { Component, createMemo, createSignal, JSX, Show } from "solid-js" | | 2 | +import { Component, ComponentProps, createMemo, createSignal, JSX, Show, ValidComponent } from "solid-js" | 3 | 3 | import { useLocal } from "@/context/local" | 4 | 4 | import { useDialog } from "@opencode-ai/ui/context/dialog" | 5 | 5 | import { popularProviders } from "@/hooks/use-providers" | @@ -86,10 +86,12 @@ const ModelList: Component<{ | 86 | 86 | ) | 87 | 87 | } | 88 | 88 |
| 89 | | -export const ModelSelectorPopover: Component<{ | | 89 | +export function ModelSelectorPopover<T extends ValidComponent = "div">(props: { | 90 | 90 | provider?: string | 91 | | - children: JSX.Element | 92 | | -}> = (props) => { | | 91 | + children?: JSX.Element | | 92 | + triggerAs?: T | | 93 | + triggerProps?: ComponentProps<T> | | 94 | +}) { | 93 | 95 | const [open, setOpen] = createSignal(false) | 94 | 96 | const dialog = useDialog() | 95 | 97 |
| @@ -101,7 +103,9 @@ export const ModelSelectorPopover: Component<{ | 101 | 103 |
| 102 | 104 | return ( | 103 | 105 | <Kobalte open={open()} onOpenChange={setOpen} placement="top-start" gutter={8}> | 104 | | - <Kobalte.Trigger as="div">{props.children}</Kobalte.Trigger> | | 106 | + <Kobalte.Trigger as={props.triggerAs ?? "div"} {...(props.triggerProps as any)}> | | 107 | + {props.children} | | 108 | + </Kobalte.Trigger> | 105 | 109 | <Kobalte.Portal> | 106 | 110 | <Kobalte.Content class="w-72 h-80 flex flex-col rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md z-50 outline-none overflow-hidden"> | 107 | 111 | <Kobalte.Title class="sr-only">{language.t("dialog.model.select.title")}</Kobalte.Title> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-select-server.tsx +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -158,6 +158,7 @@ export function DialogSelectServer() { | 158 | 158 | icon="circle-x" | 159 | 159 | variant="ghost" | 160 | 160 | class="bg-transparent transition-opacity shrink-0 hover:scale-110" | | 161 | + aria-label="Remove server" | 161 | 162 | onClick={(e) => { | 162 | 163 | e.stopPropagation() | 163 | 164 | handleRemove(i) | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/prompt-input.tsx +35-15Lines changed: 35 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1487,6 +1487,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1487 | 1487 | variant="ghost" | 1488 | 1488 | class="h-6 w-6" | 1489 | 1489 | onClick={() => prompt.context.removeActive()} | | 1490 | + aria-label="Remove active file from context" | 1490 | 1491 | /> | 1491 | 1492 | </div> | 1492 | 1493 | )} | @@ -1524,6 +1525,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1524 | 1525 | variant="ghost" | 1525 | 1526 | class="h-6 w-6" | 1526 | 1527 | onClick={() => prompt.context.remove(item.key)} | | 1528 | + aria-label="Remove file from context" | 1527 | 1529 | /> | 1528 | 1530 | </div> | 1529 | 1531 | )} | @@ -1556,6 +1558,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1556 | 1558 | type="button" | 1557 | 1559 | onClick={() => removeImageAttachment(attachment.id)} | 1558 | 1560 | class="absolute -top-1.5 -right-1.5 size-5 rounded-full bg-surface-raised-stronger-non-alpha border border-border-base flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity hover:bg-surface-raised-base-hover" | | 1561 | + aria-label="Remove attachment" | 1559 | 1562 | > | 1560 | 1563 | <Icon name="close" class="size-3 text-text-weak" /> | 1561 | 1564 | </button> | @@ -1574,6 +1577,13 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1574 | 1577 | editorRef = el | 1575 | 1578 | props.ref?.(el) | 1576 | 1579 | }} | | 1580 | + role="textbox" | | 1581 | + aria-multiline="true" | | 1582 | + aria-label={ | | 1583 | + store.mode === "shell" | | 1584 | + ? language.t("prompt.placeholder.shell") | | 1585 | + : language.t("prompt.placeholder.normal", { example: language.t(EXAMPLES[store.placeholder]) }) | | 1586 | + } | 1577 | 1587 | contenteditable="true" | 1578 | 1588 | onInput={handleInput} | 1579 | 1589 | onPaste={handlePaste} | @@ -1638,21 +1648,22 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1638 | 1648 | </TooltipKeybind> | 1639 | 1649 | } | 1640 | 1650 | > | 1641 | | - <ModelSelectorPopover> | 1642 | | - <TooltipKeybind | 1643 | | - placement="top" | 1644 | | - title={language.t("command.model.choose")} | 1645 | | - keybind={command.keybind("model.choose")} | | 1651 | + <TooltipKeybind | | 1652 | + placement="top" | | 1653 | + title={language.t("command.model.choose")} | | 1654 | + keybind={command.keybind("model.choose")} | | 1655 | + > | | 1656 | + <ModelSelectorPopover | | 1657 | + triggerAs={Button} | | 1658 | + triggerProps={{ variant: "ghost" }} | 1646 | 1659 | > | 1647 | | - <Button as="div" variant="ghost"> | 1648 | | - <Show when={local.model.current()?.provider?.id}> | 1649 | | - <ProviderIcon id={local.model.current()!.provider.id as IconName} class="size-4 shrink-0" /> | 1650 | | - </Show> | 1651 | | - {local.model.current()?.name ?? language.t("dialog.model.select.title")} | 1652 | | - <Icon name="chevron-down" size="small" /> | 1653 | | - </Button> | 1654 | | - </TooltipKeybind> | 1655 | | - </ModelSelectorPopover> | | 1660 | + <Show when={local.model.current()?.provider?.id}> | | 1661 | + <ProviderIcon id={local.model.current()!.provider.id as IconName} class="size-4 shrink-0" /> | | 1662 | + </Show> | | 1663 | + {local.model.current()?.name ?? language.t("dialog.model.select.title")} | | 1664 | + <Icon name="chevron-down" size="small" /> | | 1665 | + </ModelSelectorPopover> | | 1666 | + </TooltipKeybind> | 1656 | 1667 | </Show> | 1657 | 1668 | <Show when={local.model.variant.list().length > 0}> | 1658 | 1669 | <TooltipKeybind | @@ -1683,6 +1694,8 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1683 | 1694 | "text-text-base": !permission.isAutoAccepting(params.id!, sdk.directory), | 1684 | 1695 | "hover:bg-surface-success-base": permission.isAutoAccepting(params.id!, sdk.directory), | 1685 | 1696 | }} | | 1697 | + aria-label="Toggle auto-accept permissions" | | 1698 | + aria-pressed={permission.isAutoAccepting(params.id!, sdk.directory)} | 1686 | 1699 | > | 1687 | 1700 | <Icon | 1688 | 1701 | name="chevron-double-right" | @@ -1711,7 +1724,13 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1711 | 1724 | <SessionContextUsage /> | 1712 | 1725 | <Show when={store.mode === "normal"}> | 1713 | 1726 | <Tooltip placement="top" value={language.t("prompt.action.attachFile")}> | 1714 | | - <Button type="button" variant="ghost" class="size-6" onClick={() => fileInputRef.click()}> | | 1727 | + <Button | | 1728 | + type="button" | | 1729 | + variant="ghost" | | 1730 | + class="size-6" | | 1731 | + onClick={() => fileInputRef.click()} | | 1732 | + aria-label="Attach file" | | 1733 | + > | 1715 | 1734 | <Icon name="photo" class="size-4.5" /> | 1716 | 1735 | </Button> | 1717 | 1736 | </Tooltip> | @@ -1743,6 +1762,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1743 | 1762 | icon={working() ? "stop" : "arrow-up"} | 1744 | 1763 | variant="primary" | 1745 | 1764 | class="h-6 w-4.5" | | 1765 | + aria-label={working() ? "Stop" : "Send message"} | 1746 | 1766 | /> | 1747 | 1767 | </Tooltip> | 1748 | 1768 | </div> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/session-context-usage.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -96,7 +96,7 @@ export function SessionContextUsage(props: SessionContextUsageProps) { | 96 | 96 | <Switch> | 97 | 97 | <Match when={variant() === "indicator"}>{circle()}</Match> | 98 | 98 | <Match when={true}> | 99 | | - <Button type="button" variant="ghost" class="size-6" onClick={openContext}> | | 99 | + <Button type="button" variant="ghost" class="size-6" onClick={openContext} aria-label="View context usage"> | 100 | 100 | {circle()} | 101 | 101 | </Button> | 102 | 102 | </Match> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/session/session-header.tsx +28-27Lines changed: 28 additions & 27 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -135,6 +135,7 @@ export function SessionHeader() { | 135 | 135 | type="button" | 136 | 136 | class="hidden md:flex w-[320px] p-1 pl-1.5 items-center gap-2 justify-between rounded-md border border-border-weak-base bg-surface-raised-base transition-colors cursor-default hover:bg-surface-raised-base-hover focus:bg-surface-raised-base-hover active:bg-surface-raised-base-active" | 137 | 137 | onClick={() => command.trigger("file.open")} | | 138 | + aria-label="Search files" | 138 | 139 | > | 139 | 140 | <div class="flex min-w-0 flex-1 items-center gap-2 overflow-visible"> | 140 | 141 | <Icon name="magnifying-glass" size="normal" class="icon-base shrink-0" /> | @@ -184,6 +185,10 @@ export function SessionHeader() { | 184 | 185 | variant="ghost" | 185 | 186 | class="group/review-toggle size-6 p-0" | 186 | 187 | onClick={() => view().reviewPanel.toggle()} | | 188 | + aria-label="Toggle review panel" | | 189 | + aria-expanded={view().reviewPanel.opened()} | | 190 | + aria-controls="review-panel" | | 191 | + tabIndex={showReview() ? 0 : -1} | 187 | 192 | > | 188 | 193 | <div class="relative flex items-center justify-center size-4 [&>*]:absolute [&>*]:inset-0"> | 189 | 194 | <Icon | @@ -214,6 +219,9 @@ export function SessionHeader() { | 214 | 219 | variant="ghost" | 215 | 220 | class="group/terminal-toggle size-6 p-0" | 216 | 221 | onClick={() => view().terminal.toggle()} | | 222 | + aria-label="Toggle terminal" | | 223 | + aria-expanded={view().terminal.opened()} | | 224 | + aria-controls="terminal-panel" | 217 | 225 | > | 218 | 226 | <div class="relative flex items-center justify-center size-4 [&>*]:absolute [&>*]:inset-0"> | 219 | 227 | <Icon | @@ -235,32 +243,23 @@ export function SessionHeader() { | 235 | 243 | </Button> | 236 | 244 | </TooltipKeybind> | 237 | 245 | </div> | 238 | | - <div | 239 | | - class="flex items-center" | 240 | | - classList={{ | 241 | | - "opacity-0 pointer-events-none": !showShare(), | 242 | | - }} | 243 | | - aria-hidden={!showShare()} | 244 | | - > | 245 | | - <Popover | 246 | | - title={language.t("session.share.popover.title")} | 247 | | - description={ | 248 | | - shareUrl() | 249 | | - ? language.t("session.share.popover.description.shared") | 250 | | - : language.t("session.share.popover.description.unshared") | 251 | | - } | 252 | | - trigger={ | 253 | | - <Tooltip class="shrink-0" value={language.t("command.session.share")}> | 254 | | - <Button | 255 | | - variant="secondary" | 256 | | - classList={{ "rounded-r-none": shareUrl() !== undefined }} | 257 | | - style={{ scale: 1 }} | 258 | | - > | 259 | | - {language.t("session.share.action.share")} | 260 | | - </Button> | 261 | | - </Tooltip> | 262 | | - } | 263 | | - > | | 246 | + <Show when={showShare()}> | | 247 | + <div class="flex items-center"> | | 248 | + <Popover | | 249 | + title={language.t("session.share.popover.title")} | | 250 | + description={ | | 251 | + shareUrl() | | 252 | + ? language.t("session.share.popover.description.shared") | | 253 | + : language.t("session.share.popover.description.unshared") | | 254 | + } | | 255 | + triggerAs={Button} | | 256 | + triggerProps={{ | | 257 | + variant: "secondary", | | 258 | + classList: { "rounded-r-none": shareUrl() !== undefined }, | | 259 | + style: { scale: 1 }, | | 260 | + }} | | 261 | + trigger={language.t("session.share.action.share")} | | 262 | + > | 264 | 263 | <div class="flex flex-col gap-2"> | 265 | 264 | <Show | 266 | 265 | when={shareUrl()} | @@ -322,10 +321,12 @@ export function SessionHeader() { | 322 | 321 | class="rounded-l-none" | 323 | 322 | onClick={copyLink} | 324 | 323 | disabled={state.unshare} | | 324 | + aria-label="Copy share link" | 325 | 325 | /> | 326 | 326 | </Tooltip> | 327 | 327 | </Show> | 328 | | - </div> | | 328 | + </div> | | 329 | + </Show> | 329 | 330 | </div> | 330 | 331 | </Portal> | 331 | 332 | )} | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/session/session-sortable-tab.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,7 +37,7 @@ export function SortableTab(props: { tab: string; onTabClose: (tab: string) => v | 37 | 37 | value={props.tab} | 38 | 38 | closeButton={ | 39 | 39 | <Tooltip value={language.t("common.closeTab")} placement="bottom"> | 40 | | - <IconButton icon="close" variant="ghost" onClick={() => props.onTabClose(props.tab)} /> | | 40 | + <IconButton icon="close" variant="ghost" onClick={() => props.onTabClose(props.tab)} aria-label="Close tab" /> | 41 | 41 | </Tooltip> | 42 | 42 | } | 43 | 43 | hideCloseButton | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/session/session-sortable-terminal-tab.tsx +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -139,6 +139,7 @@ export function SortableTerminalTab(props: { terminal: LocalPTY; onClose?: () => | 139 | 139 | e.stopPropagation() | 140 | 140 | close() | 141 | 141 | }} | | 142 | + aria-label="Close terminal" | 142 | 143 | /> | 143 | 144 | } | 144 | 145 | > | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/pages/layout.tsx +7-4Lines changed: 7 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1916,6 +1916,7 @@ export default function Layout(props: ParentProps) { | 1916 | 1916 | "bg-surface-base-hover border border-border-weak-base": !selected() && open(), | 1917 | 1917 | }} | 1918 | 1918 | onClick={() => navigateToProject(props.project.worktree)} | | 1919 | + onBlur={() => setOpen(false)} | 1919 | 1920 | > | 1920 | 1921 | <ProjectIcon project={props.project} notify /> | 1921 | 1922 | </button> | @@ -2343,7 +2344,8 @@ export default function Layout(props: ParentProps) { | 2343 | 2344 | <div class="relative bg-background-base flex-1 min-h-0 flex flex-col select-none [&_input]:select-text [&_textarea]:select-text [&_[contenteditable]]:select-text"> | 2344 | 2345 | <Titlebar /> | 2345 | 2346 | <div class="flex-1 min-h-0 flex"> | 2346 | | - <div | | 2347 | + <nav | | 2348 | + aria-label="Projects and sessions" | 2347 | 2349 | classList={{ | 2348 | 2350 | "hidden xl:block": true, | 2349 | 2351 | "relative shrink-0": true, | @@ -2364,7 +2366,7 @@ export default function Layout(props: ParentProps) { | 2364 | 2366 | onCollapse={layout.sidebar.close} | 2365 | 2367 | /> | 2366 | 2368 | </Show> | 2367 | | - </div> | | 2369 | + </nav> | 2368 | 2370 | <div class="xl:hidden"> | 2369 | 2371 | <div | 2370 | 2372 | classList={{ | @@ -2376,7 +2378,8 @@ export default function Layout(props: ParentProps) { | 2376 | 2378 | if (e.target === e.currentTarget) layout.mobileSidebar.hide() | 2377 | 2379 | }} | 2378 | 2380 | /> | 2379 | | - <div | | 2381 | + <nav | | 2382 | + aria-label="Projects and sessions" | 2380 | 2383 | classList={{ | 2381 | 2384 | "@container fixed top-10 bottom-0 left-0 z-50 w-72 bg-background-base transition-transform duration-200 ease-out": true, | 2382 | 2385 | "translate-x-0": layout.mobileSidebar.opened(), | @@ -2385,7 +2388,7 @@ export default function Layout(props: ParentProps) { | 2385 | 2388 | onClick={(e) => e.stopPropagation()} | 2386 | 2389 | > | 2387 | 2390 | <SidebarContent mobile /> | 2388 | | - </div> | | 2391 | + </nav> | 2389 | 2392 | </div> | 2390 | 2393 |
| 2391 | 2394 | <main | |
|