Skip to content

fix: center title-only toast content - #175

Merged
starc007 merged 1 commit into
starc007:mainfrom
hruilabs:codex/fix-toast-title-alignment
Sep 12, 2026
Merged

starc007 merged 1 commit into
starc007:mainfrom
hruilabs:codex/fix-toast-title-alignment

Conversation

@hruilabs

Copy link
Copy Markdown
Contributor

A title-only toast such as “Saved” sits above its status icon and dismiss button. The row always uses top alignment: the title has a 20px line height, the controls are 28px high, and the icon has an additional 2px top margin.

Center the row and remove the icon offset when neither a description nor an action is present. Toasts with descriptions or actions keep their current top alignment. Add a persistent “Title only” preview, update the component date, and cover updating an existing toast from detailed content to a title only.

Reproduction

<AnimatedToastStack
  toasts={[{ id: "saved", title: "Saved", status: "success", duration: 0 }]}
  onDismiss={() => {}}
/>

Before this change, the icon center is 6px below the title center. All three elements should share a vertical center.

Validation

  • bun run check passed: TypeScript, Biome lint, and all 82 registry components.
  • bun test passed: 424 tests, including 6 toast regression cases. The title-only, empty-description, and details-removed cases failed before the fix.
  • The local upstream preview was checked in Chromium: title, icon, and dismiss centers all measured at y=43px.
  • The equivalent patch was also exercised in a consuming app with Chromium at 1280px and 390px: title/icon/dismiss centers align within 1px, description/action combinations retain top alignment, and dismissal, reduced motion, and short-viewport scrolling remain functional. Those browser checks use the consuming app's adapted component; the Bun tests here assert the upstream component's rendered layout classes because Happy DOM does not perform layout.

@starc007

Copy link
Copy Markdown
Owner

Thanks for fixing the toast alignment and adding the preview and regression coverage! Nice attention to detail.

@starc007
starc007 merged commit 8d3fa7b into starc007:main Sep 12, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants