Enter and Exit
FreeMount and unmount panels so they fade or slide without leaving invisible focus traps.
Purpose
Handle presence correctly for menus, dialogs, and toasts.
Procedure
--- name: enter-exit description: Mount and unmount panels so they fade or slide without leaving invisible focus traps. ---
Enter and Exit
Purpose
Handle presence correctly for menus, dialogs, and toasts.
Procedure
If a panel leaves the tree, its exit has to finish before unmount or the exit never plays. Use the project's existing presence tool. If there is none, do not add a dependency for a fade; a CSS transition on a data-state attribute is enough when the node stays mounted while closed (hidden and inert).
Dialogs and menus:
- Move focus inside on open and back to the trigger on close.
- Escape closes.
- The underlay does not scroll the page behind.
- Exit is faster than enter (about 150ms versus 200ms).
Do not animate the dialog from scale(0). A small translate (8px) plus opacity is enough. Under reduced motion, show and hide instantly but keep the focus move.
Do not exit-animate a route's entire page if the framework already swaps it without a presence wrapper. You will flash both pages or drop the exit.
Lists: do not animate every row on first paint. Animate the row that was inserted or removed if the user just did that action.
Example requests
1. Dialog presence
Request: Apply Enter and Exit to the confirm dialog. Keep focus restoration. Expected: The dialog animates in, and focus returns to the trigger after close.
Dependencies
None. Work in the repository that is already open. Do not add packages unless the procedure names one.
Compatibility
This document follows the Agent Skills layout (a folder named enter-exit containing SKILL.md). Claude Code, Cursor, Codex, and Gemini CLI can load that file from the paths in the Skilling installation guide. GitHub Copilot does not load SKILL.md. Use the Copilot instructions copy, and narrow applyTo before you commit it.
Example prompts
Dialog presence
Apply Enter and Exit to the confirm dialog. Keep focus restoration.
Expected: The dialog animates in, and focus returns to the trigger after close.
Choose the agent
This skill is installed for one agent at a time. Pick the section you are using.
Related
- Motion Rules
Add motion only to explain a change: 150–250ms, ease-out, and a reduced-motion path.
- Route Transitions
Transition between application routes without delaying the next page or double-mounting data.
- Press Feedback
Give buttons and rows a pressed state that does not shift layout.
Reviews
No reviews yet.
Sign in to review.
Report a problem
Inaccurate steps, an unsafe instruction, or a licensing concern.
Sign in to report.