fix(webui): crossfade theme changes as one page (#6459)

* fix(webui): crossfade theme changes as one page

* test(webui): align selection highlight motion checks

Follow the shared CSS transition contract instead of obsolete Tailwind utilities. Verify normal geometry easing and reduced-motion theme paint in the browser without changing accepted theme behavior or relaxing CI gates.
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-25 23:54:06 +08:00
1 parent 4701218719
commit 83b6112843
20 files changed
+538 -67

No files matched your search

+1 -1
View File
@@ -1829,7 +1829,7 @@ function ProjectGroupHeader({
function ChatsGroupHeader({ label }: { label: string }) {
return (
<div className="px-2 pb-2 pt-2 text-[11px] font-medium leading-4 text-sidebar-muted-foreground">
<div data-theme-ink className="px-2 pb-2 pt-2 text-[11px] font-medium leading-4 text-sidebar-muted-foreground">
{label}
</div>
);
+1
View File
@@ -96,6 +96,7 @@ export function MarkdownText({
const plainFallback = (
<div
data-theme-ink
className={cn(
"whitespace-pre-wrap break-words text-reading text-foreground/92",
streaming && "streaming-text-fallback",
+4 -1
View File
@@ -387,7 +387,7 @@ function IncomingSessionMessage({
<div className="mb-1.5 flex items-center px-4 text-[12px] text-muted-foreground">
<SessionHandleLabel id={handle.id}>{handleName}</SessionHandleLabel>
</div>
<div className="relative min-w-0 rounded-floating bg-secondary/70 px-4 py-2">
<div data-theme-surface className="relative min-w-0 rounded-floating bg-secondary/70 px-4 py-2">
{contextMenu}
<div data-assistant-selectable="true" className="min-w-0">
<MarkdownText
@@ -489,6 +489,7 @@ export function MessageBubble({
<div data-user-text-bubble className="relative ml-auto w-fit max-w-full min-w-0">
{contextMenu}
<p
data-theme-surface
data-temporary-message={temporary ? "true" : undefined}
className={cn(
"ml-auto w-fit max-w-full min-w-0 rounded-floating px-4 py-2",
@@ -561,6 +562,8 @@ export function MessageBubble({
function UserQuotedContext({ text, label }: { text: string; label: string }) {
return (
<blockquote
data-theme-surface
data-theme-ink
className={cn(
"ml-auto flex w-fit max-w-full min-w-0 items-start gap-2 rounded-control",
"border border-border/60 bg-muted/35 px-3 py-2 text-left text-muted-foreground",
+5 -1
View File
@@ -155,6 +155,8 @@ export function Sidebar(props: SidebarProps) {
return (
<nav
data-theme-surface
data-theme-ink
ref={props.containActionMenus ? setMenuPortalContainer : undefined}
aria-label={t("sidebar.navigation")}
className={cn(
@@ -323,8 +325,10 @@ export function Sidebar(props: SidebarProps) {
onRequestUpdate={props.availableUpdate.onRequestUpdate} installationMethod={props.availableUpdate.installationMethod} />
)}
<div
data-theme-surface
className={cn(
"flex items-center justify-between gap-1 bg-sidebar/55 px-2.5 py-3 text-xs",
"flex items-center justify-between gap-1 px-2.5 py-3 text-xs",
props.hostChromeInset && "bg-sidebar/55",
collapsed && "w-14 flex-col px-0",
)}
>
@@ -121,7 +121,7 @@ export function SidebarSelectionHighlight({
data-testid={`${scope}-selection-highlight`}
data-active-id={activeId ?? undefined}
aria-hidden="true"
className={cn("pointer-events-none absolute left-0 top-0 z-0 !mt-0 rounded-control bg-sidebar-foreground/[0.055] opacity-0 transition-[transform,width,height] duration-300 ease-out will-change-transform motion-reduce:transition-none dark:bg-white/[0.07]", highlightClassName)}
className={cn("sidebar-selection-highlight pointer-events-none absolute left-0 top-0 z-0 !mt-0 rounded-control bg-sidebar-foreground/[0.055] opacity-0 will-change-transform dark:bg-white/[0.07]", highlightClassName)}
/>
</div>
);
@@ -126,7 +126,7 @@ export function HostSwitcherView({ picker, status, collapsed = false, portalCont
const current = `${identity}, ${currentLabel}`;
const detail = pendingName ? `${current}. ${t("remote.preparing", { name: pendingName })}` : current;
const button = <Button ref={buttonRef} variant="ghost" size="sm" aria-label={t("remote.switchHost")}
data-host-switcher className={cn("host-no-drag touch-target h-8 min-w-0 gap-2 rounded-xl px-2 text-xs font-normal text-sidebar-content/75 hover:text-sidebar-content",
data-host-switcher data-theme-surface data-theme-ink className={cn("host-no-drag touch-target h-8 min-w-0 gap-2 rounded-xl px-2 text-xs font-normal text-sidebar-content/75 hover:text-sidebar-content",
collapsed ? "w-8 justify-center px-0" : "max-w-full flex-1 justify-start")}
onClick={picker.kind === "embedded" ? () => {
const rect = buttonRef.current?.getBoundingClientRect();
+2 -1
View File
@@ -75,6 +75,7 @@ export function ThreadHeader({
)}
>
<div
data-theme-surface
className={cn(
controlsClassName,
"relative min-w-0",
@@ -111,7 +112,7 @@ export function ThreadHeader({
) : null}
</div>
<div className={cn(controlsClassName, "ml-auto shrink-0")}>
<div data-theme-surface className={cn(controlsClassName, "ml-auto shrink-0")}>
{sessionInfoAction}
{promptNavigatorAction}
{actions}
@@ -335,6 +335,7 @@ function HeroGreeting({ text }: { text: string }) {
<h1
ref={headingRef}
data-testid="hero-greeting"
data-theme-ink
className="select-none whitespace-nowrap text-[34px] font-normal leading-[1.08] tracking-normal text-foreground sm:text-[48px] sm:leading-tight"
>
{text}
@@ -1203,6 +1203,7 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
<div
ref={composerDockRef}
data-testid="thread-composer-dock"
data-theme-surface
onInputCapture={(event) => {
if (event.target instanceof HTMLTextAreaElement) {
threadMotionRef.current?.handleComposerInput();
@@ -678,6 +678,7 @@ export function PaneWorkbench({
return (
<section
ref={setNavigationFrame}
data-theme-surface
aria-label={t("workbench.aria", { defaultValue: "Conversation workbench" })}
className={cn(
"thread-workspace relative flex h-full min-h-0 flex-col overflow-hidden bg-background",
@@ -693,9 +694,10 @@ export function PaneWorkbench({
/>
</header>
) : null}
<div className="workbench-body relative min-h-0 flex-1 bg-background">
<div className="workbench-body relative min-h-0 flex-1">
<div
ref={gridRef}
data-theme-surface
data-testid="pane-grid"
data-layout={effectiveLayout}
className={cn(
@@ -715,6 +717,7 @@ export function PaneWorkbench({
else paneRefs.current.delete(pane.key);
}}
aria-label={pane.title}
data-theme-surface
data-active={active ? "true" : "false"}
data-dragging={draggingPaneKey === pane.key ? "true" : undefined}
data-testid={`workbench-pane-${pane.key}`}
@@ -830,7 +833,7 @@ export function PaneWorkbench({
</div>
{chrome ? (
<footer className="workbench-composer-footer shrink-0 bg-background px-3 pb-[calc(0.5rem+env(safe-area-inset-bottom))] sm:px-4 sm:pb-[calc(0.75rem+env(safe-area-inset-bottom))]">
<footer className="workbench-composer-footer shrink-0 px-3 pb-[calc(0.5rem+env(safe-area-inset-bottom))] sm:px-4 sm:pb-[calc(0.75rem+env(safe-area-inset-bottom))]">
<div
ref={setComposerPortalTarget}
data-testid="workbench-composer-host"