Skip to content

fix(modal): prevent close animation flicker#2404

Open
janburzinski wants to merge 1 commit into
mainfrom
emdash/new-conversation-flicker-fix-6xort
Open

fix(modal): prevent close animation flicker#2404
janburzinski wants to merge 1 commit into
mainfrom
emdash/new-conversation-flicker-fix-6xort

Conversation

@janburzinski

Copy link
Copy Markdown
Collaborator

Description

  • fixes the flicker on the new conversation modal

Screenshot/Recording (if applicable)

https://streamable.com/00gah3

Checklist
  • I kept this PR small and focused
  • I ran a self-review before opening this PR
  • I ran the relevant local checks or explained why not
  • I updated docs when behavior or setup changed
  • I added or updated tests when behavior changed, or explained why not
  • I only added comments where the logic is not obvious
  • I used Conventional Commits for commit
    messages and, when possible, the PR title

@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a close-animation flicker on modals by appending data-closed:fill-mode-forwards to the Tailwind class strings of every animated dialog element. The animation-fill-mode: forwards rule holds the animation's final keyframe (opacity 0, scale 95%) in place until JS actually unmounts the element, preventing a brief flash back to the visible state during busy renders.

  • modal-renderer.tsx: adds fill-mode-forwards to the custom DialogPrimitive.Popup used by the shared modal renderer.
  • dialog.tsx: adds fill-mode-forwards to both the DialogPrimitive.Backdrop overlay and the DialogPrimitive.Popup used by the DialogContent wrapper component.

Confidence Score: 5/5

Safe to merge — the change is a one-line addition per element that only activates during the exit animation path.

The fix is narrow and well-understood: animation-fill-mode: forwards is scoped to the data-closed state, so it cannot affect the open animation or any other rendering path. The same utility is applied consistently across all three animated elements (backdrop, modal-renderer popup, dialog popup), so there are no asymmetric cases that could introduce new flicker. No logic, data flow, or API surface is changed.

No files require special attention.

Important Files Changed

Filename Overview
src/renderer/lib/modal/modal-renderer.tsx Adds data-closed:fill-mode-forwards to the custom modal popup's class string; change is minimal, targeted, and correct.
src/renderer/lib/ui/dialog.tsx Adds data-closed:fill-mode-forwards to both the backdrop overlay and the dialog popup; correctly mirrors the same fix applied in modal-renderer.

Sequence Diagram

sequenceDiagram
    participant User
    participant MobX as MobX Store
    participant React as React/JS
    participant CSS as CSS Animation

    User->>MobX: Close modal
    MobX->>React: "modalStore.isOpen = false"
    React->>CSS: Sets data-closed attribute
    CSS->>CSS: Plays fade-out + zoom-out animation (100ms)
    Note over CSS: BEFORE fix: animation ends, element reverts to visible state while React schedules unmount
    Note over CSS: AFTER fix: fill-mode-forwards holds final frame (opacity:0, scale:0.95) until unmount
    React->>React: Schedules unmount (async, may be delayed by busy renders)
    React->>CSS: Removes element from DOM
Loading

Reviews (1): Last reviewed commit: "fix(modal): prevent close animation flic..." | Re-trigger Greptile

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