fix(session-ui): prevent long quotes from shrinking comment icons (#61241)

This commit is contained in:
usrnk1
2026-11-02 12:30:32 +01:00
committed by GitHub
Unverified
parent ef6dd07aab
commit 67139d6827
4 changed files with 51 additions and 4 deletions
@@ -1,5 +1,26 @@
import { expect, story } from "../../stories/playwright/story"
story("keeps quote attachment icons fixed while long text truncates", async ({ mount, page }) => {
const gallery = await mount("current-session-timeline-rows--quote-attachments")
await page.evaluate(() => document.fonts.ready.then(() => undefined))
for (const title of ["Remove this", "Can we make this smaller?"]) {
const icon = gallery
.locator('[data-component="attachment-card"]')
.filter({ hasText: title })
.locator('[data-slot="icon-svg"]')
await expect(icon).toHaveCSS("width", "12px")
await expect(icon).toHaveCSS("height", "12px")
}
const label = gallery.locator('[data-slot="attachment-card-label"]').filter({ hasText: "It has a 32px minimum" })
expect(await label.evaluate((element) => element.scrollWidth > element.clientWidth)).toBe(true)
await expect(label).toHaveCSS("text-overflow", "ellipsis")
})
story.describe("message actions menu", () => {
story.use({ timezoneId: "UTC" })
@@ -57,13 +57,14 @@
align-items: center;
gap: 4px;
min-width: 0;
min-height: 16px;
overflow: hidden;
white-space: nowrap;
font-weight: 440;
color: var(--v2-text-text-muted);
[data-component="file-icon"],
[data-slot="attachment-card-icon"] {
[data-slot="icon-svg"] {
width: 12px;
height: 12px;
flex: none;
@@ -121,7 +121,7 @@ export function CommentCard(props: {
<Match when={props.target.type === "note" ? props.target : undefined}>
{(note) => (
<>
<Icon name={note().icon} data-slot="attachment-card-icon" />
<Icon name={note().icon} />
<span data-slot="attachment-card-label" dir="ltr">
{subtitle()}
</span>
@@ -132,14 +132,14 @@ export function CommentCard(props: {
{(text) => (
<>
<span data-slot="comment-card-quote">
<Icon name={source()?.icon ?? "outline-quote"} data-slot="attachment-card-icon" />
<Icon name={source()?.icon ?? "outline-quote"} />
<span data-slot="attachment-card-label" dir="auto">
{props.comment ? text() : (source()?.label ?? i18n.t("ui.commentCard.quote"))}
</span>
</span>
<Show when={props.onClick}>
<span data-slot="comment-card-action" data-commented={props.comment ? "" : undefined}>
<Icon name="comment" data-slot="attachment-card-icon" />
<Icon name="comment" />
<span data-slot="attachment-card-label">
{props.comment ? i18n.t("ui.commentCard.editComment") : i18n.t("ui.commentCard.addComment")}
</span>
@@ -545,6 +545,31 @@ export const PromptWithAttachments = {
),
}
export const QuoteAttachments = {
render: () => (
<div
style={{
padding: "24px",
display: "grid",
"grid-template-columns": "minmax(0, 1fr)",
gap: "8px",
width: "360px",
"max-width": "100%",
}}
>
<CommentCard comment="Remove this" target={{ type: "quote", text: "The menu is hovered." }} wide />
<CommentCard
comment="Can we make this smaller?"
target={{
type: "quote",
text: "It has a 32px minimum, capped at the track height. The remaining space is reserved for the timeline content.",
}}
wide
/>
</div>
),
}
export const NoteAttachments = {
render: () => {
const [state, setState] = createStore({ selected: "None" })