fix(chat): repair the message row layout and action buttons
Three defects reported from real-machine testing, all rooted in the same few conflicting CSS blocks, so they are fixed together — separating them would leave intermediate states that render worse than either end. The action buttons showed wrapped vertical text inside a 2rem box. styles.css already defined .message-action-label, a clip-rect screen-reader-only class clearly written for these buttons, but nothing in the tree ever used it: ChatPanel rendered a bare span. Wire the class up so the buttons are icon-only, and drop the border so they read as plain icons rather than pills. .chat-message-actions and its buttons were defined five times across the stylesheet, three of those styling them as bordered pills that the final block then partially overrode. Remove .chat-message-actions button from the three pill rule groups and the small-screen grid rule, leaving one definition next to .message-action-icon. .chat-runtime-actions and .chat-stop-button keep the pill treatment; they are different controls. The avatar rendered below its bubble instead of beside it. .chat-message-row used align-items: flex-end, and .chat-message-content is taller than the bubble because the action bar reserves a row, so the avatar was pinned to the bottom of that taller box. Align to the top. Removing visibility: hidden from the hidden action bar also closes F-40 (audit P2-24): visibility 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. Verified against the real stylesheet in a browser: avatar and bubble tops differ by 0px, the button computes to 34x34 with 0px border, the label measures 1x1, and focusing a button takes the bar from opacity 0 to 1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
这个提交存在于:
父节点
178fba70ea
当前提交
fa48a21e65
共有 2 个文件被更改,包括 31 次插入 和 33 次删除
|
|
@ -819,7 +819,7 @@ export function ChatPanel({ fixedSlot }: ChatPanelProps) {
|
|||
className="message-action-icon icon-copy"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span>复制</span>
|
||||
<span className="message-action-label">复制</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -831,7 +831,7 @@ export function ChatPanel({ fixedSlot }: ChatPanelProps) {
|
|||
className="message-action-icon icon-retry"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span>重试</span>
|
||||
<span className="message-action-label">重试</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -843,7 +843,7 @@ export function ChatPanel({ fixedSlot }: ChatPanelProps) {
|
|||
className="message-action-icon icon-read"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span>朗读</span>
|
||||
<span className="message-action-label">朗读</span>
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
|
|
|
|||
|
|
@ -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%);
|
||||
|
|
|
|||
正在加载…
添加表格
在新工单中引用