Skip to content

fix(overlays): stop dialogs animating in from the top-left corner - #1

Merged
MiniCodeMonkey merged 1 commit into
mainfrom
fix/overlay-entry-transform-double-centering
Sep 3, 2026
Merged

fix(overlays): stop dialogs animating in from the top-left corner#1
MiniCodeMonkey merged 1 commit into
mainfrom
fix/overlay-entry-transform-double-centering

Conversation

@MiniCodeMonkey

Copy link
Copy Markdown
Member

Summary

Dialogs, confirm prompts and the command palette animated in from the top-left corner instead of scaling gently into place.

transform and translate are two separate CSS properties, and the browser composes them: translate is applied first, transform after. These popups are centred with Tailwind's -translate-x-1/2 -translate-y-1/2 utilities, which in Tailwind v4 compile to the standalone translate property. The entry/exit rules in styles/overlays.css repeated that same -50% inside transform, so the centring was applied twice for the length of the transition. On a 1200px viewport the dialog started 192px left and 105px above its final position and slid down-right into place.

The fix leaves only the entry offset and the scale in transform, and lets the Tailwind utilities own the centring.

Changes

  • .ui-popup starting/ending style is now translateY(4px) scale(0.98), down from translate(-50%, calc(-50% + 4px)) scale(0.98). This covers Dialog and ConfirmDialog.
  • .ui-palette starting/ending style is now translateY(-4px) scale(0.98), down from translate(-50%, -4px) scale(0.98). This covers CommandPalette.
  • The toast-in keyframe in styles/animations.css carried the same duplicated -50% on X. No component in this package uses it, but it is exported for consumers, so it is fixed the same way.
  • Comments in both files now state how translate and transform compose, so the -50% does not get added back.

No component or TypeScript changes. All 35 unit tests pass.

https://claude.ai/code/session_01911q7fpiGHjD2mYpf3r3QJ

`transform` and `translate` are separate CSS properties that compose:
the browser applies `translate` first and `transform` after. The dialog
and command palette are centred with Tailwind's translate utilities,
which in v4 compile to the standalone `translate` property, but the
entry/exit rules repeated the same -50% inside `transform`. The
centring was therefore applied twice for the length of the transition,
so a dialog started roughly half its own size up and to the left of
where it belonged and slid down-right into place.

Leave only the entry offset and scale in `transform`. The `toast-in`
keyframe carried the same duplicated -50% on X; it is unused inside the
package but is exported for consumers, so it is fixed the same way.

Claude-Session: https://claude.ai/code/session_01911q7fpiGHjD2mYpf3r3QJ
@MiniCodeMonkey
MiniCodeMonkey merged commit 1fe8056 into main Sep 3, 2026
1 check 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.

1 participant