diff --git a/src/features/chat/ChatPanel.tsx b/src/features/chat/ChatPanel.tsx index 8a11710..4a2b500 100644 --- a/src/features/chat/ChatPanel.tsx +++ b/src/features/chat/ChatPanel.tsx @@ -819,7 +819,7 @@ export function ChatPanel({ fixedSlot }: ChatPanelProps) { className="message-action-icon icon-copy" aria-hidden="true" /> - 复制 + 复制 ) : null} diff --git a/src/styles.css b/src/styles.css index 072d8fe..662ead5 100644 --- a/src/styles.css +++ b/src/styles.css @@ -508,7 +508,11 @@ select:focus { .chat-message-row { display: flex; - align-items: flex-end; + /* Aligns the avatar with the top of the bubble. It used to be `flex-end`, + which pinned the avatar to the bottom of `.chat-message-content` — and that + box is taller than the bubble because the action bar reserves a row, so the + avatar rendered below the bubble instead of beside it. */ + align-items: flex-start; gap: 0.55rem; width: min(82%, 46rem); justify-self: start; @@ -2176,14 +2180,10 @@ body, } .chat-runtime-actions, -.chat-message-actions { - display: flex; - flex-wrap: wrap; - gap: 6px; -} - +/* `.chat-message-actions button` is intentionally absent from these pill rules. + Message actions are borderless icon buttons; their single definition lives + further down next to `.message-action-icon`. */ .chat-runtime-actions button, -.chat-message-actions button, .chat-stop-button { border: 1px solid var(--line, #c8d8ea); border-radius: 999px; @@ -2195,7 +2195,6 @@ body, } .chat-runtime-actions button:hover, -.chat-message-actions button:hover, .chat-stop-button:hover { background: var(--soft-accent, #eaf3ff); color: var(--accent, #2f6fb2); @@ -2266,10 +2265,6 @@ body, color: var(--accent, #2f6fb2); } -.chat-message-actions { - margin-top: 8px; -} - .chat-stop-button { margin-top: 8px; border-color: #d88d8d; @@ -2459,7 +2454,6 @@ textarea:focus-visible, } .chat-runtime-actions button, -.chat-message-actions button, .chat-stop-button { min-height: 2rem; border: 1px solid var(--ui-line); @@ -2469,7 +2463,6 @@ textarea:focus-visible, } .chat-runtime-actions button:hover, -.chat-message-actions button:hover, .chat-stop-button:hover { border-color: var(--ui-line-strong); color: var(--ui-ink); @@ -2659,7 +2652,6 @@ textarea:focus-visible, } .chat-runtime-actions button, -.chat-message-actions button, .chat-stop-button, .voice-button, .file-picker, @@ -2668,6 +2660,10 @@ textarea:focus-visible, touch-action: manipulation; } +.chat-message-actions button { + touch-action: manipulation; +} + .chat-runtime-actions button:disabled { border-color: var(--ui-line); color: var(--ui-subtle); @@ -2738,17 +2734,11 @@ textarea:focus-visible, } .chat-runtime-actions button, - .chat-message-actions button, .chat-stop-button, .voice-button, .file-picker { width: 100%; } - - .chat-message-actions { - display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - } } :root { @@ -3125,27 +3115,31 @@ button:disabled { transform: translateY(-0.2rem); transition: opacity 150ms ease, - transform 150ms ease, - visibility 150ms ease; - visibility: hidden; + transform 150ms ease; } +/* Deliberately no `visibility: hidden`. It removed the buttons from the tab + order, so `:focus-within` could never fire and a keyboard user could never + reveal them. Opacity alone keeps them focusable. */ .chat-message-row:hover .chat-message-actions, .chat-message-row:focus-within .chat-message-actions { opacity: 1; pointer-events: auto; transform: translateY(0); - visibility: visible; } +/* The single definition of a message action button: borderless, icon only. + The visible label is carried by `.message-action-label`, which is clipped for + screen readers, so the button must never be sized for text. */ .chat-message-actions button { display: inline-flex; align-items: center; justify-content: center; width: 2rem; + height: 2rem; min-height: 2rem; padding: 0; - border: 1px solid transparent; + border: 0; border-radius: 0.55rem; color: var(--ui-subtle); background: transparent; @@ -3154,11 +3148,15 @@ button:disabled { .chat-message-actions button:hover:not(:disabled), .chat-message-actions button:focus-visible { - border-color: var(--ui-line); color: var(--ui-ink); background: var(--ui-surface-soft); } +.chat-message-actions button:hover:not(:disabled) .message-action-icon, +.chat-message-actions button:focus-visible .message-action-icon { + color: var(--ui-ink); +} + .message-action-label { position: absolute; width: 1px; @@ -3285,11 +3283,12 @@ button:disabled { } .chat-message-actions button { + width: 2.1rem; + height: 2.1rem; min-height: 2.1rem; } } - /* Stable chat session pills and native-style window controls. */ .chat-session-list { flex: 0 0 auto; @@ -3364,7 +3363,6 @@ button:disabled { } } - .message-attachment-image { display: block; max-width: min(22rem, 100%);