fix(ui): fix accessibility hierarchy, dark mode button contrast, and layout regressions

This commit is contained in:
lzt404 committed 2026-10-04 17:31:52 +08:00
1 parent 247c39f388
commit adb84bbfec
8 files changed
+131 -33

No files matched your search

+3 -3
View File
@@ -494,7 +494,7 @@ export const en: Record<MessageKey, string> = {
'usage.stat.successMetaTitle': '{success} succeeded, {failed} failed, {canceled} canceled', 'usage.stat.successMetaTitle': '{success} succeeded, {failed} failed, {canceled} canceled',
'usage.stat.averageLatency': 'Average Latency', 'usage.stat.averageLatency': 'Average Latency',
'usage.stat.tps': 'TPS', 'usage.stat.tps': 'TPS',
'usage.stat.performanceMeta': '{samples} samples · RPM {rpm} · {latency} ms', 'usage.stat.performanceMeta': '{samples} samples · RPM {rpm}',
'usage.stat.performanceMetaTitle': 'TPS {tps} (weighted by total latency), {samples} valid samples, RPM {rpm}, average latency {latency} ms', 'usage.stat.performanceMetaTitle': 'TPS {tps} (weighted by total latency), {samples} valid samples, RPM {rpm}, average latency {latency} ms',
'usage.stat.cacheHitRate': 'Cache Hit Rate', 'usage.stat.cacheHitRate': 'Cache Hit Rate',
'usage.stat.cacheHitMeta': 'Read {hit} · Input {input}', 'usage.stat.cacheHitMeta': 'Read {hit} · Input {input}',
@@ -1456,8 +1456,8 @@ export const en: Record<MessageKey, string> = {
'kernel.install.completed': '{version} installed', 'kernel.install.completed': '{version} installed',
'kernel.error.progressListener': 'Failed to listen for download progress: {error}', 'kernel.error.progressListener': 'Failed to listen for download progress: {error}',
'kernel.action.start': 'start', 'kernel.action.start': 'start',
'kernel.action.stop': 'stop', 'kernel.action.stop': 'Stop',
'kernel.action.restart': 'restart', 'kernel.action.restart': 'Restart',
'kernel.notice.actionSuccess': 'Core {action} succeeded', 'kernel.notice.actionSuccess': 'Core {action} succeeded',
'kernel.notice.actionFailed': 'Core {action} failed: {error}', 'kernel.notice.actionFailed': 'Core {action} failed: {error}',
'kernel.notice.networkRestarted': 'Network settings saved and the core restarted', 'kernel.notice.networkRestarted': 'Network settings saved and the core restarted',
+2 -1
View File
@@ -984,6 +984,7 @@ export function ConfigPanelPage() {
return ( return (
<section className="page config-page"> <section className="page config-page">
<h1 className="sr-only">{t('app.nav.config')}</h1>
<div className="agent-subpage-tabs config-subpage-tabs" role="tablist" aria-label={t('config.tabs.label')}> <div className="agent-subpage-tabs config-subpage-tabs" role="tablist" aria-label={t('config.tabs.label')}>
<button <button
type="button" type="button"
@@ -1694,7 +1695,7 @@ export function ConfigPanelPage() {
</button> </button>
))} ))}
</div> </div>
<small title={settings?.routingStrategy || undefined}> <small className="sr-only" title={settings?.routingStrategy || undefined}>
{loading {loading
? t('common.loading') ? t('common.loading')
: settings === null : settings === null
+1 -1
View File
@@ -219,6 +219,7 @@ export function KernelPage({ view = 'home' }: { view?: KernelView }) {
return ( return (
<section className="page kernel-page home-page"> <section className="page kernel-page home-page">
<h1 className="sr-only">{t('app.nav.home')}</h1>
<div className="kernel-layout home-layout"> <div className="kernel-layout home-layout">
<div className="panel control-panel"> <div className="panel control-panel">
<div className="panel-heading"> <div className="panel-heading">
@@ -426,7 +427,6 @@ export function KernelPage({ view = 'home' }: { view?: KernelView }) {
<button <button
type="button" type="button"
className="home-quick-card" className="home-quick-card"
aria-label="Token 统计与请求日志"
onClick={() => window.dispatchEvent(new CustomEvent('app:navigate', { detail: 'usage-records' }))} onClick={() => window.dispatchEvent(new CustomEvent('app:navigate', { detail: 'usage-records' }))}
> >
<span className="home-quick-icon"> <span className="home-quick-icon">
+5
View File
@@ -558,6 +558,11 @@ export function ThinkingAliasesPage({ embedded = false }: { embedded?: boolean }
<MessageNotice tone="success" message={!error ? notice : null} onDismiss={() => setNotice('')} /> <MessageNotice tone="success" message={!error ? notice : null} onDismiss={() => setNotice('')} />
<header className="management-header"> <header className="management-header">
<div>
{embedded
? <h2>{t('app.nav.thinkingAliases')}</h2>
: <h1>{t('app.nav.thinkingAliases')}</h1>}
</div>
<div className="management-heading-actions"> <div className="management-heading-actions">
<span className="muted-summary">{entries.length}</span> <span className="muted-summary">{entries.length}</span>
<button <button
+23 -14
View File
@@ -9,6 +9,7 @@ import {
RefreshCw, RefreshCw,
RotateCcw, RotateCcw,
Trash2, Trash2,
X,
} from 'lucide-react'; } from 'lucide-react';
import { useCoreRuntime } from '../coreRuntime'; import { useCoreRuntime } from '../coreRuntime';
import { useCoreUpdate } from '../coreUpdate'; import { useCoreUpdate } from '../coreUpdate';
@@ -485,16 +486,16 @@ export function VersionManagementPage() {
: t('common.close'); : t('common.close');
const installDialogActionDisabled = (installing || progress?.running) && (cancellingInstall || !progress?.cancellable); const installDialogActionDisabled = (installing || progress?.running) && (cancellingInstall || !progress?.cancellable);
const closeCustomMirrorDialog = () => {
setCustomMirrorDialogOpen(false);
setCustomMirrorDraft('');
setVersionSourceError('');
};
const customMirrorDialogRef = useDialogFocusTrap<HTMLFormElement>({ const customMirrorDialogRef = useDialogFocusTrap<HTMLFormElement>({
active: customMirrorDialogOpen, active: customMirrorDialogOpen,
initialFocusRef: customMirrorInputRef, initialFocusRef: customMirrorInputRef,
onEscape: versionSourceSaving onEscape: versionSourceSaving ? undefined : closeCustomMirrorDialog,
? undefined
: () => {
setCustomMirrorDialogOpen(false);
setCustomMirrorDraft('');
setVersionSourceError('');
},
preventEscape: versionSourceSaving, preventEscape: versionSourceSaving,
}); });
const confirmUpdateDialogRef = useDialogFocusTrap<HTMLElement>({ const confirmUpdateDialogRef = useDialogFocusTrap<HTMLElement>({
@@ -718,8 +719,20 @@ export function VersionManagementPage() {
}} }}
> >
<div className="install-dialog-heading"> <div className="install-dialog-heading">
<span>{t('kernel.versions.downloadSource')}</span> <div>
<h2 id="custom-mirror-dialog-title">{t('kernel.versions.customMirrorDialogTitle')}</h2> <span>{t('kernel.versions.downloadSource')}</span>
<h2 id="custom-mirror-dialog-title">{t('kernel.versions.customMirrorDialogTitle')}</h2>
</div>
<button
type="button"
className="icon-button quiet"
onClick={closeCustomMirrorDialog}
disabled={versionSourceSaving}
title={t('common.close')}
aria-label={t('common.close')}
>
<X size={18} aria-hidden="true" />
</button>
</div> </div>
<p className="custom-mirror-dialog-description"> <p className="custom-mirror-dialog-description">
{t('kernel.versions.customMirrorDialogDescription')} {t('kernel.versions.customMirrorDialogDescription')}
@@ -758,11 +771,7 @@ export function VersionManagementPage() {
type="button" type="button"
className="secondary-button" className="secondary-button"
disabled={versionSourceSaving} disabled={versionSourceSaving}
onClick={() => { onClick={closeCustomMirrorDialog}
setCustomMirrorDialogOpen(false);
setCustomMirrorDraft('');
setVersionSourceError('');
}}
> >
{t('common.cancel')} {t('common.cancel')}
</button> </button>
+3 -3
View File
@@ -106,7 +106,7 @@
--theme-f8f6f1: #f8f6f1; --theme-f8f6f1: #f8f6f1;
--theme-faf8f2: #faf8f2; --theme-faf8f2: #faf8f2;
--theme-faf8f4: #faf8f4; --theme-faf8f4: #faf8f4;
--theme-faf9f5: #ffffff; --theme-faf9f5: #f6f7f5;
--theme-fdf1ee: #fdf1ee; --theme-fdf1ee: #fdf1ee;
--theme-fff: #fff; --theme-fff: #fff;
--theme-fff1ee: #fff1ee; --theme-fff1ee: #fff1ee;
@@ -115,7 +115,7 @@
--theme-fffdf8: #fffdf8; --theme-fffdf8: #fffdf8;
--theme-ffffff: #ffffff; --theme-ffffff: #ffffff;
--bg-secondary: #ffffff; --bg-secondary: #f6f7f5;
--bg-primary: #ffffff; --bg-primary: #ffffff;
--bg-tertiary: #f8fafc; --bg-tertiary: #f8fafc;
--bg-hover: #f1f5f9; --bg-hover: #f1f5f9;
@@ -8568,7 +8568,7 @@ textarea:focus-visible {
.usage-overview-layout { .usage-overview-layout {
display: grid; display: grid;
grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr); grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
grid-template-rows: auto minmax(280px, 1fr); grid-template-rows: max-content minmax(280px, 1fr);
gap: 14px; gap: 14px;
align-items: stretch; align-items: stretch;
overflow-x: hidden; overflow-x: hidden;
+91 -8
View File
@@ -4,12 +4,12 @@
/* 1. Global Light Theme Surface & Contrast Variables */ /* 1. Global Light Theme Surface & Contrast Variables */
:root { :root {
--bg-secondary: #ffffff; --bg-secondary: #f6f7f5;
--bg-primary: #ffffff; --bg-primary: #ffffff;
--bg-card: #ffffff; --bg-card: #ffffff;
--bg-tertiary: #f8fafc; --bg-tertiary: #eff3f0;
--bg-hover: #f1f5f9; --bg-hover: #f6f8f6;
--bg-quinary: #f8fafc; --bg-quinary: #f9faf9;
--border-color: #e2e8f0; --border-color: #e2e8f0;
--border-secondary: #f1f5f9; --border-secondary: #f1f5f9;
--border-primary: #cbd5e1; --border-primary: #cbd5e1;
@@ -18,7 +18,7 @@
--text-secondary: #1e293b; --text-secondary: #1e293b;
--text-tertiary: #334155; --text-tertiary: #334155;
--text-quaternary: #475569; --text-quaternary: #475569;
--theme-faf9f5: #ffffff; --theme-faf9f5: #f6f7f5;
--theme-faf8f4: #ffffff; --theme-faf8f4: #ffffff;
--theme-faf8f2: #ffffff; --theme-faf8f2: #ffffff;
--theme-fffdf8: #ffffff; --theme-fffdf8: #ffffff;
@@ -216,6 +216,13 @@ body, html, #root {
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 8px; border-radius: 8px;
padding: 6px 12px; padding: 6px 12px;
flex-shrink: 0;
white-space: nowrap;
}
.client-api-panel .client-api-meta {
white-space: nowrap;
flex-shrink: 0;
} }
.client-api-card { .client-api-card {
@@ -233,8 +240,16 @@ body, html, #root {
} }
.client-api-card-heading { .client-api-card-heading {
width: 144px; min-width: 144px;
flex-basis: 144px; width: auto;
flex: 0 1 auto;
}
.client-api-card-heading .client-api-format-tag,
.client-api-card-heading span {
font-size: var(--font-size-caption);
white-space: nowrap;
overflow: visible;
} }
.client-api-card-heading .client-api-format-tag, .client-api-card-heading .client-api-format-tag,
@@ -450,6 +465,8 @@ body, html, #root {
} }
.oauth-card { .oauth-card {
display: flex;
flex-direction: column;
padding: 22px; padding: 22px;
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 12px; border-radius: 12px;
@@ -458,6 +475,16 @@ body, html, #root {
transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
} }
.oauth-card .oauth-card-body,
.oauth-card .oauth-hint {
flex: 1;
}
.oauth-card .oauth-card-actions,
.oauth-card > button.primary-button {
margin-top: auto;
}
.oauth-card:hover { .oauth-card:hover {
border-color: var(--border-primary); border-color: var(--border-primary);
box-shadow: var(--ui-card-hover-shadow); box-shadow: var(--ui-card-hover-shadow);
@@ -786,7 +813,7 @@ body, html, #root {
} }
.secondary-button { .secondary-button {
background: #ffffff; background: var(--bg-primary);
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
color: var(--text-secondary); color: var(--text-secondary);
border-radius: 8px; border-radius: 8px;
@@ -800,6 +827,18 @@ body, html, #root {
color: var(--text-primary); color: var(--text-primary);
} }
:root[data-theme='dark'] .secondary-button {
background: var(--bg-card);
border-color: var(--border-color);
color: var(--text-primary);
}
:root[data-theme='dark'] .secondary-button:hover:not(:disabled) {
background: var(--bg-tertiary);
border-color: var(--border-primary);
color: var(--text-primary);
}
.danger-button { .danger-button {
background: #fff1f2; background: #fff1f2;
border: 1px solid #fecdd3; border: 1px solid #fecdd3;
@@ -815,6 +854,50 @@ body, html, #root {
color: #ffffff; color: #ffffff;
} }
:root[data-theme='dark'] .danger-button {
background: rgba(225, 29, 72, 0.14);
border-color: rgba(225, 29, 72, 0.35);
color: #fb7185;
}
:root[data-theme='dark'] .danger-button:hover:not(:disabled) {
background: #e11d48;
border-color: #e11d48;
color: #ffffff;
}
/* Quota Progress Bar Polish */
.real-quota-track {
height: 8px;
overflow: hidden;
border-radius: 999px;
background: var(--bg-hover);
}
.real-quota-track span {
display: block;
height: 100%;
border-radius: inherit;
background: var(--ui-accent);
}
/* Agent List & Config Scrollbar Polish */
.agent-list-items::-webkit-scrollbar,
.agent-config-scroll-region::-webkit-scrollbar {
width: 6px;
}
.agent-list-items::-webkit-scrollbar-thumb,
.agent-config-scroll-region::-webkit-scrollbar-thumb {
background: var(--border-primary);
border-radius: 4px;
}
.agent-list-items::-webkit-scrollbar-track,
.agent-config-scroll-region::-webkit-scrollbar-track {
background: transparent;
}
/* Responsive Shell (Preserved from existing accessibility rules) */ /* Responsive Shell (Preserved from existing accessibility rules) */
@media (max-width: 900px) { @media (max-width: 900px) {
.app-shell:not(.app-shell-easy-mode) { .app-shell:not(.app-shell-easy-mode) {
+3 -3
View File
@@ -27,7 +27,7 @@ const path = require('node:path');
assert.equal(await page.getByRole('heading', { level: 1, name: '首页' }).count(), 1); assert.equal(await page.getByRole('heading', { level: 1, name: '首页' }).count(), 1);
await page.getByRole('button', { name: '使用记录' }).click(); await page.locator('.nav-section').getByRole('button', { name: '使用记录' }).click();
const tabs = page.getByRole('tab'); const tabs = page.getByRole('tab');
assert.equal(await tabs.count(), 5); assert.equal(await tabs.count(), 5);
assert.deepEqual(await tabs.evaluateAll((elements) => elements assert.deepEqual(await tabs.evaluateAll((elements) => elements
@@ -39,7 +39,7 @@ const path = require('node:path');
await page.getByRole('tab', { name: /数据管理/ }).click(); await page.getByRole('tab', { name: /数据管理/ }).click();
assert.equal(await page.locator('.usage-filter-panel').count(), 0); assert.equal(await page.locator('.usage-filter-panel').count(), 0);
await page.getByRole('button', { name: '高级功能' }).click(); await page.locator('.nav-section').getByRole('button', { name: '高级功能' }).click();
assert.equal(await page.locator('h1').count(), 1); assert.equal(await page.locator('h1').count(), 1);
const configTabs = page.locator('.config-subpage-tabs').getByRole('tab'); const configTabs = page.locator('.config-subpage-tabs').getByRole('tab');
assert.deepEqual(await configTabs.evaluateAll((elements) => elements assert.deepEqual(await configTabs.evaluateAll((elements) => elements
@@ -60,7 +60,7 @@ const path = require('node:path');
assert.equal(await addKey.evaluate((element) => document.activeElement === element), true); assert.equal(await addKey.evaluate((element) => document.activeElement === element), true);
await page.setViewportSize({ width: 640, height: 600 }); await page.setViewportSize({ width: 640, height: 600 });
await page.getByRole('button', { name: '首页' }).click(); await page.locator('.nav-section').getByRole('button', { name: '首页' }).click();
const sidebarHeight = await page.locator('.sidebar').evaluate((element) => element.getBoundingClientRect().height); const sidebarHeight = await page.locator('.sidebar').evaluate((element) => element.getBoundingClientRect().height);
assert.ok(sidebarHeight < 150, `compact sidebar is too tall: ${sidebarHeight}px`); assert.ok(sidebarHeight < 150, `compact sidebar is too tall: ${sidebarHeight}px`);