feat(webui): stabilize session transitions and goal presentation

Keep the composer stable during interruptible session changes. Move active and blocked goals into the header with localized gallery previews, and preserve focus when overlays close. Include the reviewed navigation, layout and accessibility fixes.
This commit is contained in:
chengyongru authored and chengyongru committed 2026-11-13 23:37:07 +08:00
1 parent e65bec9a6e
commit ce3f36983d
58 files changed
+1874 -453

No files matched your search

@@ -37,6 +37,11 @@ export function SettingsFeature({
const { t } = useTranslation();
const [open, setOpen] = useState(initialOpen && enabled);
const section = useRef<HTMLElement>(null);
const opener = useRef<HTMLElement | null>(null);
const changeOpen = (next: boolean) => {
if (next) opener.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
setOpen(next);
};
useEffect(() => {
if (initialOpen && enabled) {
setOpen(true);
@@ -46,7 +51,7 @@ export function SettingsFeature({
return (
<section ref={section} aria-label={title}>
<Dialog open={Boolean(children) && open} onOpenChange={(next) => {
setOpen(next);
changeOpen(next);
if (!next) onClose?.();
}}>
<SettingsGroup>
@@ -65,10 +70,17 @@ export function SettingsFeature({
</button>
</DialogTrigger> : null}
<ToggleButton checked={enabled} disabled={disabled} ariaLabel={title} label={title}
onChange={(next) => { setOpen(next); onChange(next); }} />
onChange={(next) => { changeOpen(next); onChange(next); }} />
</SettingsRow>
</SettingsGroup>
{children ? <DialogContent aria-describedby={undefined} className="settings-grid max-h-[85dvh] w-[min(calc(100vw-2rem),40rem)] max-w-none overflow-y-auto p-0 [--settings-surface:var(--background)]">
{children ? <DialogContent aria-describedby={undefined} onCloseAutoFocus={(event) => {
if (opener.current?.isConnected && !opener.current.matches(":disabled")) {
opener.current.focus({ preventScroll: true });
// Saving on close can disable the switch that opened this dialog.
// Let Radix restore its Configure trigger if the opener cannot focus.
if (document.activeElement === opener.current) event.preventDefault();
}
}} className="settings-grid max-h-[85dvh] w-[min(calc(100vw-2rem),40rem)] max-w-none overflow-y-auto p-0 [--settings-surface:var(--background)]">
<DialogTitle className="sr-only">{title}</DialogTitle>
<div className="pb-4 pt-8">{children}</div>
</DialogContent> : null}