Skip to content

Commit 249e0f0

Browse files
committed
add a11y for extra contents
1 parent 24013bb commit 249e0f0

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

tools/server/public/index.html.gz

124 Bytes
Binary file not shown.

tools/server/webui/src/components/ChatInputExtraContextItem.tsx

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,26 @@ export default function ChatInputExtraContextItem({
1818
if (!items) return null;
1919

2020
return (
21-
<div className="flex flex-row gap-4 overflow-x-auto py-2 px-1 mb-1">
21+
<div
22+
className="flex flex-row gap-4 overflow-x-auto py-2 px-1 mb-1"
23+
role="group"
24+
aria-description="Selected files"
25+
>
2226
{items.map((item, i) => (
2327
<div
2428
className="indicator"
2529
key={i}
2630
onClick={() => clickToShow && setShow(i)}
31+
tabIndex={0}
32+
aria-description={
33+
clickToShow ? `Click to show: ${item.name}` : undefined
34+
}
35+
role={clickToShow ? 'button' : 'menuitem'}
2736
>
2837
{removeItem && (
2938
<div className="indicator-item indicator-top">
3039
<button
40+
aria-label="Remove file"
3141
className="btn btn-neutral btn-sm w-4 h-4 p-0 rounded-full"
3242
onClick={() => removeItem(i)}
3343
>
@@ -46,13 +56,16 @@ export default function ChatInputExtraContextItem({
4656
<>
4757
<img
4858
src={item.base64Url}
49-
alt={item.name}
59+
alt={`Preview image for ${item.name}`}
5060
className="w-14 h-14 object-cover rounded-md"
5161
/>
5262
</>
5363
) : (
5464
<>
55-
<div className="w-14 h-14 flex items-center justify-center">
65+
<div
66+
className="w-14 h-14 flex items-center justify-center"
67+
aria-description="Document icon"
68+
>
5669
<DocumentTextIcon className="h-8 w-14 text-base-content/50" />
5770
</div>
5871

@@ -66,16 +79,25 @@ export default function ChatInputExtraContextItem({
6679
))}
6780

6881
{showingItem && (
69-
<dialog className="modal modal-open">
82+
<dialog
83+
className="modal modal-open"
84+
aria-description={`Preview ${showingItem.name}`}
85+
>
7086
<div className="modal-box">
7187
<div className="flex justify-between items-center mb-4">
7288
<b>{showingItem.name ?? 'Extra content'}</b>
73-
<button className="btn btn-ghost btn-sm">
89+
<button
90+
className="btn btn-ghost btn-sm"
91+
aria-label="Close preview dialog"
92+
>
7493
<XMarkIcon className="h-5 w-5" onClick={() => setShow(-1)} />
7594
</button>
7695
</div>
7796
{showingItem.type === 'imageFile' ? (
78-
<img src={showingItem.base64Url} alt={showingItem.name} />
97+
<img
98+
src={showingItem.base64Url}
99+
alt={`Preview image for ${showingItem.name}`}
100+
/>
79101
) : (
80102
<div className="overflow-x-auto">
81103
<pre className="whitespace-pre-wrap break-words text-sm">

tools/server/webui/src/components/SettingDialog.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ export default function SettingDialog({
336336
<div
337337
className="hidden md:flex flex-col items-stretch pr-4 mr-4 border-r-2 border-base-200"
338338
role="complementary"
339+
aria-description="Settings sections"
340+
tabIndex={0}
339341
>
340342
{SETTING_SECTIONS.map((section, idx) => (
341343
<button

0 commit comments

Comments
 (0)