Skip to content

Commit 342eb7a

Browse files
Hide the formatting toolbar while a comment card is open
A selection's fixed formatting toolbar stayed above an open orphan or anchored comment card and covered it. The orphan card's offset is now one custom property shared by its top and max-height. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a4f5dbe commit 342eb7a

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

‎e2e/sidecar.e2e.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,19 @@ test("a removed subject block moves its comment to document orphan chrome", asyn
13251325
await expect(page.getByRole("dialog", { name: "Orphaned comments" })).toContainText(QUOTED);
13261326
});
13271327

1328+
test("an open comment card hides the formatting toolbar of a lingering selection", async ({ join, seed }) => {
1329+
await seed(TWO_BLOCKS);
1330+
let page = await join("ana");
1331+
await page.setViewportSize({ width: 1_280, height: 800 });
1332+
await content(page).locator("p").nth(1).selectText();
1333+
let toolbar = page.getByRole("toolbar", { name: "Text formatting" });
1334+
await expect(toolbar).toBeVisible();
1335+
1336+
let card = await thread(page);
1337+
await expect(card).toBeVisible();
1338+
await expect(toolbar).toBeHidden();
1339+
});
1340+
13281341
test("the orphaned comments popover shows its whole card beneath the pill", async ({ join, seed }) => {
13291342
await seed(TWO_BLOCKS);
13301343
let page = await join("ana");
@@ -1334,9 +1347,16 @@ test("the orphaned comments popover shows its whole card beneath the pill", asyn
13341347
await page.keyboard.press("Backspace");
13351348
await page.keyboard.press("Backspace");
13361349

1350+
// A selection's formatting toolbar would sit over the card it opens.
1351+
await content(page).locator("p").first().selectText();
1352+
let toolbar = page.getByRole("toolbar", { name: "Text formatting" });
1353+
await expect(toolbar).toBeVisible();
1354+
13371355
let opener = page.getByRole("button", { name: "1 orphaned comments" });
13381356
await opener.click();
13391357
let popover = page.getByRole("dialog", { name: "Orphaned comments" });
1358+
await expect(popover).toBeVisible();
1359+
await expect(toolbar).toBeHidden();
13401360
// The card sizes against the document, not the pill that holds it.
13411361
let reply = popover.getByRole("textbox", { name: "Reply", exact: true });
13421362
await expect(reply).toBeInViewport({ ratio: 1 });

‎packages/editor/src/styles.css‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,10 +1489,11 @@
14891489
}
14901490

14911491
.plan-comment-orphan-card {
1492-
top: 2.5rem;
1492+
--orphan-card-offset: 2.5rem;
1493+
top: var(--orphan-card-offset);
14931494
right: 0;
14941495
width: min(20rem, calc(100cqi - 1rem));
1495-
max-height: calc(100% - 2.5rem);
1496+
max-height: calc(100% - var(--orphan-card-offset));
14961497
}
14971498

14981499
/* The scrim every phone sheet shares, lighter while this sheet rests at its medium detent. */
@@ -5441,6 +5442,11 @@ body:has(.plan-comment-sheet-popup[data-swiping])
54415442
animation: plan-bubble-enter var(--duration-fast) var(--ease-out);
54425443
}
54435444

5445+
/* An open comment card owns the reader's attention; a lingering selection's toolbar would cover it. */
5446+
:root:has(.plan-comment-card.motion-comment-surface:not(.is-closing)) .plan-formatting-toolbar {
5447+
display: none;
5448+
}
5449+
54445450
@media (prefers-reduced-motion: reduce) {
54455451
.plan-formatting-toolbar {
54465452
animation: none;

0 commit comments

Comments
 (0)