Skip to content

Commit 83ab69c

Browse files
committed
fix(toast): hide a toast's text at once when it goes behind, and edge the peeks
A toast that moved behind the front one faded its text over 150ms while its card shrank to the front toast's height, so the older description showed below a shorter, title-only toast in front, and the texts overlapped as a fanned-out stack collapsed. Its content now hides at once and fades back in when the stack fans out or the toast comes to the front. The peeks of the toasts behind sat under the front toast's dark shadow and nearly vanished in Dark. A toast behind now has a 1px inset edge (both themes), removed when the stack fans out.
1 parent 0aa5d49 commit 83ab69c

4 files changed

Lines changed: 32 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
Changes to `@usememos/ui` that an app can see. New entries go under "Unreleased"; when a release ships, that heading becomes its version (see "Releasing" in `AGENTS.md`). Breaking changes are also marked with `!` in their commit.
44

5+
## Unreleased
6+
7+
### Visual changes
8+
9+
- **A toast's text no longer shows below a newer, shorter toast.** When a toast moved behind the front one, its text faded out over 150ms while its card shrank, so for a moment the old description showed under a title-only toast in front, and the same happened when a fanned-out stack collapsed. A toast behind the front one now hides its text at once; it still fades in when the stack fans out or the toast comes to the front.
10+
- **The toasts behind the front one are visible in Dark.** Their peeks sat under the front toast's dark shadow and nearly disappeared, so a stack read as one toast. A toast behind now has a 1px inset `edge`, in both themes. It goes away when the stack fans out.
11+
512
## 26.11.8
613

714
Published 6 November 2026.

‎docs/components/toast.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ Base UI's props pass through: `timeout` (default 5000ms) and `limit` (default 3)
5454

5555
- `mu-popup`, `toast-width` wide, top-right at `space-6` from the edges; below `breakpoint-sm`, full width across the top at `space-4`, below the status bar.
5656
- A tone icon (`Info`, `CircleCheck`, `TriangleAlert`, `CircleAlert`) in `ink-muted`, `success`, `warning` or `danger`; title in `label`; description in `caption` `ink-muted`; the action as a small neutral Button; the X as a small ghost Button.
57-
- Newest in front; the ones behind peek out `space-2` below and shrink. Hover or focus fans them out downward, `space-3` apart. Toasts slide in from above and can be swiped up or to the right. Under reduced motion they only fade.
57+
- Newest in front; the ones behind peek out `space-2` below and shrink. A toast behind hides its text at once and gets a 1px `edge`, so its text never shows below a shorter front toast and the peeks stay visible in Dark. Hover or focus fans them out downward, `space-3` apart. Toasts slide in from above and can be swiped up or to the right. Under reduced motion they only fade.

‎e2e/overlays.spec.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,25 @@ test('Toast: shows a toast with its action, and the X closes it', async ({ page
200200
await expect(toast).toHaveCount(0);
201201
});
202202

203+
test('Toast: a toast behind hides its text at once and shows its edge; fanned out, it shows both again', async ({ page }) => {
204+
await open(page);
205+
const triggers = page.locator('#toast');
206+
await triggers.getByRole('button', { name: 'Archive' }).click();
207+
await triggers.getByRole('button', { name: 'Save' }).click();
208+
await page.mouse.move(5, 5);
209+
// Archive's toast is taller than Save's; its text must not fade out below the shorter front toast.
210+
const behind = page.locator('.mu-toast', { hasText: 'Note archived' }).locator('.mu-toast-content');
211+
await expect(behind).toHaveAttribute('data-behind', '');
212+
await expect(behind).toHaveCSS('transition-duration', '0s');
213+
await expect(behind).toHaveCSS('opacity', '0');
214+
// The 1px `edge` (#d0d0d0 in Light) keeps the peek visible.
215+
await expect(behind).toHaveCSS('box-shadow', 'rgb(208, 208, 208) 0px 0px 0px 1px inset');
216+
await page.locator('.mu-toast', { hasText: 'Settings saved' }).hover();
217+
await expect(behind).toHaveAttribute('data-expanded', '');
218+
await expect(behind).toHaveCSS('opacity', '1');
219+
await expect(behind).toHaveCSS('box-shadow', 'none');
220+
});
221+
203222
test('popups only fade under reduced motion', async ({ page }) => {
204223
await page.emulateMedia({ reducedMotion: 'reduce' });
205224
await open(page);

‎packages/ui/src/components/toast/toast.css‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@
5858
height: 100%;
5959
padding: var(--mu-space-3) var(--mu-space-3) var(--mu-space-3) var(--mu-space-4);
6060
overflow: hidden;
61+
border-radius: inherit;
6162
transition: opacity var(--mu-duration-settle) var(--mu-ease-out);
6263
}
63-
.mu-toast-content[data-behind] { opacity: 0; }
64-
.mu-toast-content[data-expanded] { opacity: 1; }
64+
/* A toast behind the front one hides its text at once, so none of it shows below a shorter front toast while the stack settles;
65+
it fades back in when the stack fans out or the toast comes to the front. Its edge keeps the peek visible in Dark, under the front toast's shadow. */
66+
.mu-toast-content[data-behind] { opacity: 0; transition: none; box-shadow: inset 0 0 0 1px var(--mu-edge); }
67+
.mu-toast-content[data-expanded] { opacity: 1; transition: opacity var(--mu-duration-settle) var(--mu-ease-out); box-shadow: none; }
6568

6669
.mu-toast-icon { margin-block: calc((var(--mu-row-height) - var(--mu-row-icon)) / 2); color: var(--mu-ink-muted); }
6770
/* Each item sits centered on a row as tall as a control, so the icon, the title and the buttons line up. */

0 commit comments

Comments
 (0)