Skip to content

Commit a8e1c66

Browse files
authored
fix(desktop): polish inline chip states (#6718)
**Category:** fix **User Impact:** Inline chips now read more consistently, fit cleanly in the composer, and show deleted message links with the same calm muted treatment as unresolved links. **Problem:** Deleted message links looked like destructive actions even though they are informational, while mention chips had slightly uneven vertical spacing, a high-set human icon, and could clip inside the composer. **Solution:** Unify unavailable-state styling, tighten chip spacing, optically align the human icon, and give composer chips enough line height to paint without changing caret behavior. <details> <summary>File changes</summary> **desktop/src/shared/styles/globals/markdown.css** Makes chip padding vertically symmetric, moves only the human `@` icon down by 1px, and shares muted colors between deleted and unresolved message links while preserving their separate semantic classes. **desktop/src/shared/styles/globals/composer.css** Adds a composer-only line height derived from the text size and chip padding so inline chips no longer clip while retaining inline caret behavior. **desktop/tests/e2e/entity-link-recipient-cards.spec.ts** Verifies deleted and unresolved chips have matching computed colors while deleted links retain their tooltip, semantics, and navigation behavior. **desktop/tests/e2e/mentions.spec.ts** Covers composer chip height, clipping, the human icon's 1px optical offset, and visual capture. </details> ## Reproduction steps 1. Open a channel containing a link to a definitively deleted message and compare it with a transient or unresolved message link; both should use the muted unavailable treatment, while the deleted link still says “Message deleted” and navigates to its fallback destination. 2. Insert a person mention in the composer; the chip should have balanced vertical spacing and paint fully without clipping. 3. Compare a person mention with a channel chip; only the human `@` icon should sit 1px lower. ## Screenshots ### Deleted message link | Before | After | | --- | --- | | ![Deleted message link before](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6718/deleted-chip-before.png) | ![Deleted message link after](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6718/deleted-chip-after.png) | ### Composer chip polish | Before | After | | --- | --- | | ![Composer mention chip before](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6718/composer-chip-before.png) | ![Composer mention chip after](https://d24qwcpro867f5.cloudfront.net/repos/buzz/prs/6718/composer-chip-after-07411aba3.png) | ## Validation - `desktop/tests/e2e/entity-link-recipient-cards.spec.ts` + `desktop/tests/e2e/mentions.spec.ts`: 82/82 passed - Desktop unit suite: 5,397 passed - Formatting and lint checks passed (existing informational warnings only) - Pre-push desktop check, typecheck, and unit tests passed at `0255c3fd49f9244cd727d0dd20c514b3a1812152` --------- Signed-off-by: Taylor Ho <[email protected]>
1 parent 8d2d0ff commit a8e1c66

4 files changed

Lines changed: 157 additions & 9 deletions

File tree

‎desktop/src/shared/styles/globals/composer.css‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
@apply text-message font-normal tracking-normal;
9797
outline: none;
9898
min-height: 1lh;
99+
padding-block: 0.0625rem;
99100
}
100101

101102
.rich-text-composer .tiptap p {
@@ -260,8 +261,14 @@
260261
caret into their decorated range and swallows the trailing space after an
261262
@mention. Composer Buzz links are atom nodes, but their labels may still
262263
fragment between characters; only the icon and leading label fragment stay
263-
together. */
264+
together. The line-height keeps each inline decoration box tall enough to
265+
paint both block-padding edges without clipping. */
264266
.rich-text-composer .tiptap .mention-chip {
265267
display: inline;
266268
min-height: 0;
269+
line-height: calc(
270+
1em +
271+
var(--inline-chip-padding-block-start) +
272+
var(--inline-chip-padding-block-end)
273+
);
267274
}

‎desktop/src/shared/styles/globals/markdown.css‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.message-markdown {
2-
--inline-chip-padding-block-start: 0.1875rem;
2+
--inline-chip-padding-block-start: 0.125rem;
33
--inline-chip-padding-block-end: 0.125rem;
44
--inline-chip-padding-inline: 0.25rem;
55
--inline-chip-min-height: calc(
@@ -101,15 +101,11 @@
101101
}
102102

103103
.message-markdown .mention-chip.buzz-link-unavailable,
104-
.message-markdown .mention-chip.buzz-link-unavailable:hover {
105-
background: hsl(var(--secondary));
106-
color: hsl(var(--secondary-foreground) / 0.7);
107-
}
108-
104+
.message-markdown .mention-chip.buzz-link-unavailable:hover,
109105
.message-markdown .mention-chip.buzz-link-deleted,
110106
.message-markdown .mention-chip.buzz-link-deleted:hover {
111-
background: hsl(var(--destructive) / 0.12);
112-
color: hsl(var(--destructive));
107+
background: hsl(var(--secondary));
108+
color: hsl(var(--secondary-foreground) / 0.7);
113109
}
114110

115111
.message-markdown .mention-chip.inbox-channel-chip {
@@ -336,6 +332,7 @@
336332
}
337333

338334
.message-markdown .inline-chip-icon-human::before {
335+
transform: translateY(calc(-50% + 0.0625rem));
339336
-webkit-mask:
340337
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8'/%3E%3C/svg%3E")
341338
center / contain no-repeat;

‎desktop/tests/e2e/entity-link-recipient-cards.spec.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,10 @@ test("deleted reply links identify deletion and fall back to their thread root",
662662
test("deleted top-level message links identify deletion and fall back to channel navigation", async ({
663663
page,
664664
}) => {
665+
await page.addInitScript(() => {
666+
window.localStorage.setItem("buzz-theme", "buzz-dark");
667+
window.localStorage.setItem("buzz-accent-color", "#c0a2f1");
668+
});
665669
const missingMessageId = "d".repeat(64);
666670
const channelId = "9dae0116-799b-5071-a0a8-fdd30a91a35d";
667671
const link = `buzz://message?channel=${channelId}&id=${missingMessageId}`;
@@ -685,6 +689,33 @@ test("deleted top-level message links identify deletion and fall back to channel
685689
);
686690
await expect(deletedLink).toHaveClass(/buzz-link-deleted/);
687691
await expect(deletedLink).not.toHaveClass(/buzz-link-unavailable/);
692+
const unavailableColors = await linkMessage.evaluate((message) => {
693+
const probe = document.createElement("span");
694+
probe.className = "mention-chip buzz-link-unavailable";
695+
message.querySelector(".message-markdown")?.append(probe);
696+
const styles = getComputedStyle(probe);
697+
const colors = {
698+
backgroundColor: styles.backgroundColor,
699+
color: styles.color,
700+
};
701+
probe.remove();
702+
return colors;
703+
});
704+
await expect
705+
.poll(() =>
706+
deletedLink.evaluate((element) => {
707+
const styles = getComputedStyle(element);
708+
return {
709+
backgroundColor: styles.backgroundColor,
710+
color: styles.color,
711+
};
712+
}),
713+
)
714+
.toEqual(unavailableColors);
715+
await waitForAnimations(page);
716+
await linkMessage.screenshot({
717+
path: `${SHOTS}/deleted-message-link-after.png`,
718+
});
688719
await deletedLink.hover();
689720
await expect(page.getByRole("tooltip")).toHaveText("Message deleted");
690721

‎desktop/tests/e2e/mentions.spec.ts‎

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { expect, test } from "@playwright/test";
22

3+
import { waitForAnimations } from "../helpers/animations";
4+
35
import {
46
installMockBridge,
57
openChannelBrowser,
@@ -844,6 +846,9 @@ test("mention autocomplete caps global people search at 50 results", async ({
844846
test("selecting a person mention inserts @Name into input", async ({
845847
page,
846848
}) => {
849+
await page.addInitScript(() => {
850+
window.localStorage.setItem("buzz-theme", "buzz-dark");
851+
});
847852
await page.goto("/");
848853
await page.getByTestId("channel-general").click();
849854
await expect(page.getByTestId("chat-title")).toHaveText("general");
@@ -872,6 +877,114 @@ test("selecting a person mention inserts @Name into input", async ({
872877
),
873878
);
874879
expect(iconMask).toContain("data:image/svg+xml");
880+
await expect(mentionChip).toHaveCSS("line-height", "18px");
881+
const scrollViewport = page.getByTestId("message-input-scroll");
882+
const paintedBounds = await mentionChip.evaluate((element) => {
883+
const chip = element.getBoundingClientRect();
884+
const viewport = element
885+
.closest("[data-testid='message-input-scroll']")
886+
?.getBoundingClientRect();
887+
if (!viewport)
888+
throw new Error("Mention chip is missing its scroll viewport");
889+
return {
890+
chipTop: chip.top,
891+
chipBottom: chip.bottom,
892+
viewportTop: viewport.top,
893+
viewportBottom: viewport.bottom,
894+
};
895+
});
896+
expect(paintedBounds.chipTop).toBeGreaterThanOrEqual(
897+
paintedBounds.viewportTop,
898+
);
899+
expect(paintedBounds.chipBottom).toBeLessThanOrEqual(
900+
paintedBounds.viewportBottom,
901+
);
902+
const humanIconTranslateY = await mentionChip.evaluate(
903+
(element) =>
904+
new DOMMatrix(getComputedStyle(element, "::before").transform).m42,
905+
);
906+
const channelIconTranslateY = await input.evaluate((composer) => {
907+
const probe = document.createElement("span");
908+
probe.className =
909+
"mention-chip inline-chip-with-icon inline-chip-icon-channel";
910+
composer.append(probe);
911+
const translateY = new DOMMatrix(
912+
getComputedStyle(probe, "::before").transform,
913+
).m42;
914+
probe.remove();
915+
return translateY;
916+
});
917+
expect(humanIconTranslateY - channelIconTranslateY).toBeCloseTo(1);
918+
919+
await input.fill("@bo");
920+
await dropdown.getByText("bob").click();
921+
await input.press("Shift+Enter");
922+
await page.keyboard.type("@bo");
923+
await dropdown.getByText("bob").click();
924+
await input.press("Shift+Enter");
925+
await page.keyboard.type("@bo");
926+
await dropdown.getByText("bob").click();
927+
const multilineChips = input.locator(".human-mention-highlight");
928+
await expect(multilineChips).toHaveCount(3);
929+
const multilinePaintBounds = await multilineChips.evaluateAll((elements) => {
930+
const viewport = elements[0]
931+
?.closest("[data-testid='message-input-scroll']")
932+
?.getBoundingClientRect();
933+
if (!viewport) {
934+
throw new Error("Mention chips are missing their scroll viewport");
935+
}
936+
return elements.map((element) => {
937+
const chip = element.getBoundingClientRect();
938+
return {
939+
chipTop: chip.top,
940+
chipBottom: chip.bottom,
941+
viewportTop: viewport.top,
942+
viewportBottom: viewport.bottom,
943+
};
944+
});
945+
});
946+
for (const bounds of multilinePaintBounds) {
947+
expect(bounds.chipTop).toBeGreaterThanOrEqual(bounds.viewportTop);
948+
expect(bounds.chipBottom).toBeLessThanOrEqual(bounds.viewportBottom);
949+
}
950+
951+
await scrollViewport.evaluate((element) => {
952+
element.style.width = "8rem";
953+
});
954+
await input.fill("A deliberately long prefix that forces @bo");
955+
await dropdown.getByText("bob").click();
956+
const wrappedChip = input.locator(".human-mention-highlight", {
957+
hasText: "bob",
958+
});
959+
const wrappedPaintBounds = await wrappedChip.evaluate((element) => {
960+
const chip = element.getBoundingClientRect();
961+
const viewport = element
962+
.closest("[data-testid='message-input-scroll']")
963+
?.getBoundingClientRect();
964+
if (!viewport)
965+
throw new Error("Mention chip is missing its scroll viewport");
966+
return {
967+
chipTop: chip.top,
968+
chipBottom: chip.bottom,
969+
viewportTop: viewport.top,
970+
viewportBottom: viewport.bottom,
971+
};
972+
});
973+
expect(wrappedPaintBounds.chipTop).toBeGreaterThanOrEqual(
974+
wrappedPaintBounds.viewportTop,
975+
);
976+
expect(wrappedPaintBounds.chipBottom).toBeLessThanOrEqual(
977+
wrappedPaintBounds.viewportBottom,
978+
);
979+
await expect(input).toHaveCSS("height", /^(?!20px$)/);
980+
await scrollViewport.evaluate((element) => {
981+
element.style.removeProperty("width");
982+
});
983+
984+
await waitForAnimations(page);
985+
await page.getByTestId("message-composer").screenshot({
986+
path: "test-results/inline-chip-polish/composer-after.png",
987+
});
875988
});
876989

877990
test("immediate ArrowLeft after a person mention is not bounced past the trailing space", async ({

0 commit comments

Comments
 (0)