Skip to content

Commit f161ca8

Browse files
PoulphunterPoulphunter
authored andcommitted
feat(a11y): Add meta tags, robots.txt, and enhance accessibility with aria-labels
Updated viewport meta tag to remove scale settings, added description meta tag, created robots.txt, and enhanced accessibility by adding aria-labels to buttons in App, ConversationList, Header, and Presets components for better localization and screen reader support.
1 parent 583c9b5 commit f161ca8

File tree

8 files changed

+25
-9
lines changed

8 files changed

+25
-9
lines changed

index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
<html lang="">
33
<head>
44
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width" />
6+
<meta name="color-scheme" content="light dark" />
57
<meta
6-
name="viewport"
7-
content="width=device-width, initial-scale=1, maximum-scale=1"
8+
name="description"
9+
content="LLaMA.cpp Web UI - Multilingual chat interface with conversation management, preset configurations, and experimental Python code execution. Built with React, TailwindCSS, and Vite for fast development."
810
/>
9-
<meta name="color-scheme" content="light dark" />
1011
<link rel="icon" type="image/png" href="assets/favicon.png" />
1112
<title>llama.cpp - chat</title>
1213
</head>

public/robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Allow: /

src/App.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ function AppLayout() {
4444
>
4545
<SettingDialog />
4646
</div>
47-
<button type="button" id="dropdown-close-helper" className="h-0 w-0" />
47+
<button
48+
type="button"
49+
aria-label="Close helper, not visible button"
50+
id="dropdown-close-helper"
51+
className="h-0 w-0"
52+
/>
4853
</div>
4954
);
5055
}

src/components/ConversationList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ export default function ConversationList() {
286286
dir="auto"
287287
>
288288
<span className="truncate">{conv.name}</span>
289-
<button
289+
<span
290290
className={'absolute tooltip tooltip-bottom z-100 top-0 right-0'}
291291
data-tip={t('ConversationList.deleteBtn')}
292292
aria-label={t('ConversationList.deleteBtn')}
@@ -301,7 +301,7 @@ export default function ConversationList() {
301301
<span className="btn">
302302
<BiX className="h-6 w-6" />
303303
</span>
304-
</button>
304+
</span>
305305
</button>
306306
))}
307307

src/components/Header.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export function HeaderThemeBlock({ id }: Readonly<{ id: string }>) {
2929
return (
3030
<div
3131
className="tooltip tooltip-bottom z-100"
32+
aria-label={t('Header.tooltipTheme')}
3233
data-tip={t('Header.tooltipTheme')}
3334
>
3435
<div id={id} className="dropdown dropdown-end dropdown-bottom">
@@ -73,6 +74,7 @@ export function HeaderLanguageBlock({ id }: Readonly<{ id: string }>) {
7374
return (
7475
<div
7576
className="tooltip tooltip-bottom z-100"
77+
aria-label={t('Header.tooltipLanguage')}
7678
data-tip={t('Header.tooltipLanguage')}
7779
>
7880
<div id={id} className="dropdown dropdown-end dropdown-bottom">
@@ -118,6 +120,7 @@ export default function Header() {
118120
<div className="flex items-center">
119121
<button
120122
className="hidden xl:block tooltip tooltip-bottom z-100"
123+
aria-label={t('Header.tooltipSettings')}
121124
data-tip={t('Header.tooltipSettings')}
122125
onClick={() => {
123126
const elem = document.getElementById('settingBlock');
@@ -133,6 +136,7 @@ export default function Header() {
133136
</button>
134137
<button
135138
className="xl:hidden tooltip tooltip-bottom z-100"
139+
aria-label={t('Header.tooltipSettings')}
136140
data-tip={t('Header.tooltipSettings')}
137141
onClick={() => {
138142
const elem = document.getElementById('settingBlock');

src/components/Presets.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export const PresetsButtonSave = () => {
9191
return (
9292
<button
9393
className="tooltip tooltip-top z-100"
94+
aria-label={t('Settings.saveBtn')}
9495
data-tip={t('Settings.saveBtn')}
9596
onClick={() => {
9697
handleSave();
@@ -118,6 +119,7 @@ export const PresetsButtonResetConfig = () => {
118119
return (
119120
<button
120121
className="tooltip tooltip-top z-100"
122+
aria-label={t('Settings.resetBtn')}
121123
data-tip={t('Settings.resetBtn')}
122124
onClick={() => {
123125
resetConfig();
@@ -213,6 +215,7 @@ export const Presets = () => {
213215
<div className="block sm:flex justify-end">
214216
<button
215217
className="tooltip tooltip-bottom z-100"
218+
aria-label={t('Settings.deletePresetBtn')}
216219
data-tip={t('Settings.deletePresetBtn')}
217220
onClick={deletePresets}
218221
onKeyDown={deletePresets}
@@ -225,6 +228,7 @@ export const Presets = () => {
225228
</button>
226229
<button
227230
className="tooltip tooltip-bottom z-100"
231+
aria-label={t('Settings.loadPresetBtn')}
228232
data-tip={t('Settings.loadPresetBtn')}
229233
onClick={() => {
230234
document?.getElementById('configJsonInput')?.click();
@@ -250,6 +254,7 @@ export const Presets = () => {
250254
</button>
251255
<button
252256
className="tooltip tooltip-bottom z-100"
257+
aria-label={t('Settings.savePresetBtn')}
253258
data-tip={t('Settings.savePresetBtn')}
254259
onClick={downloadPresets}
255260
onKeyDown={downloadPresets}

src/components/SettingDialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ export default function SettingDialog() {
274274
<div className="flex flex-row items-center justify-between mt-4 absolute top-0 right-0 z-50">
275275
<button
276276
className="tooltip tooltip-bottom z-100"
277+
aria-label={t('Settings.CloseBtn')}
277278
data-tip={t('Settings.CloseBtn')}
278279
onClick={() => {
279280
const elem = document.getElementById('settingBlock');

src/utils/app.context.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ export const AppContextProvider = ({
402402
};
403403
// send request
404404
const fetchResponse = await fetch(
405-
import.meta.env.DEV
406-
? '/demo-conversation'
407-
: `${BASE_URL}/v1/chat/completions`,
405+
isDev ? '/demo-conversation' : `${BASE_URL}/v1/chat/completions`,
408406
{
409407
method: 'POST',
410408
headers: {

0 commit comments

Comments
 (0)