How to Optimize Tooltip Delays on Subsequent Hovers: A Complete Implementation Guide
Skip the delay and animation for tooltips triggered after the first one is visible to create an instant hover experience that maintains user flow.
The emilkowalski/skills repository defines specific recommendations for tooltip delays on subsequent hovers within its design engineering standards. According to the source documentation, tooltips should employ a brief initial delay of approximately 200–250 milliseconds to prevent accidental activation, but once a tooltip is visible, all subsequent hover interactions within the same context should trigger instantly without animation.
Why Tooltip Timing Matters
Initial Delay Prevents Accidental Activation
A short initial delay serves as an intentionality filter. When users pass their cursor fleetingly over an element, they do not expect immediate feedback. The repository recommends approximately 200–250 ms of delay for first-time hovers to distinguish between accidental cursor passes and deliberate exploration. This pause ensures tooltips appear only when users genuinely intend to view help text, protecting the interface from feeling twitchy or intrusive.
Subsequent Hovers Should Be Instant
Once the first tooltip is visible, the user has signaled their intent to explore the toolbar or control group. At this point, the recommendation is to eliminate both the delay and the entrance animation entirely. As documented in skills/emil-design-eng/SKILL.md, "Instant tooltips after the first one is open (skip delay + skip animation) make the whole toolbar feel faster" (lines 143–150). The skills/review-animations/STANDARDS.md file reinforces this: "Instant tooltips after the first (skip delay + animation) make a toolbar feel faster" (line 49).
Implementation Pattern from emilkowalski/skills
State Tracking at the Toolbar Level
The canonical implementation involves tracking tooltip state at the container level rather than individual element level. Maintain a Boolean flag—conventionally named tooltipOpen—that persists while the user remains within the toolbar context. This flag should:
- Set to
trueon the first tooltip'smouseenterevent - Reset to
falseonly when themouseleaveevent fires on the entire toolbar container, not individual items
This architectural choice decouples behavior logic from styling, allowing JavaScript to manage state while CSS handles the visual transitions.
CSS Transition Control
Use a data attribute—typically data-instant—to toggle transition behavior. When the global state indicates a tooltip is already open, apply this attribute to subsequent tooltip elements to disable CSS transitions. The base transition should use a duration of approximately 125 ms for opacity and transform properties to create a subtle fade-and-scale effect on first appearance.
Complete Code Examples
CSS Implementation
The following pattern appears in skills/emil-design-eng/SKILL.md (lines 47–55):
/* Base tooltip – includes a short fade/scale transition */
.tooltip {
transition: transform 125ms ease-out, opacity 125ms ease-out;
transform-origin: var(--transform-origin);
}
/* When the tooltip should appear instantly (no animation) */
.tooltip[data-instant] {
transition: none;
}
/* Optional: hide before showing */
.tooltip[data-starting-style],
.tooltip[data-ending-style] {
opacity: 0;
transform: scale(0.97);
}
React Implementation
import { useState } from 'react';
import './tooltip.css';
function Toolbar() {
const [tooltipOpen, setTooltipOpen] = useState(false);
const handleFirstEnter = () => setTooltipOpen(true);
const handleLeave = () => setTooltipOpen(false);
return (
<div className="toolbar" onMouseLeave={handleLeave}>
<button
className="icon-btn"
onMouseEnter={handleFirstEnter}
data-tooltip="First"
data-instant={tooltipOpen ? '' : undefined}
>
<span className="tooltip">First</span>
📁
</button>
<button
className="icon-btn"
data-tooltip="Second"
data-instant={tooltipOpen ? '' : undefined}
>
<span className="tooltip">Second</span>
📂
</button>
</div>
);
}
The first mouseenter sets tooltipOpen to true. All subsequent tooltip elements receive the data-instant attribute, which removes the transition via the CSS selector.
Vanilla JavaScript Implementation
let toolbar = document.querySelector('.toolbar');
let firstHover = true;
toolbar.addEventListener('mouseenter', (e) => {
if (e.target.matches('[data-tooltip]')) {
if (!firstHover) {
e.target.setAttribute('data-instant', '');
} else {
firstHover = false; // first tooltip gets normal delay+animation
}
}
});
toolbar.addEventListener('mouseleave', () => {
firstHover = true; // reset when leaving the toolbar
});
Source Files and References
skills/emil-design-eng/SKILL.md: Contains the primary recommendation for instant subsequent tooltips and the reference CSS implementation (lines 47–55 and 143–150).skills/review-animations/STANDARDS.md: Reinforces the performance guideline for eliminating tooltip delays after initial activation (line 49).skills/improve-animations/AUDIT.md: Includes audit criteria that flag "tooltip delay + animation on every tooltip" as a performance and UX anti-pattern requiring the instant-hover fix.
Summary
- Use a 200–250 ms initial delay to prevent accidental tooltip activation.
- Eliminate both delay and animation for all subsequent hovers after the first tooltip opens.
- Track state at the toolbar/container level rather than per-element to maintain context.
- Use a
data-instantattribute to toggle CSS transitions off for immediate subsequent displays. - Target 125 ms duration for initial tooltip entrance animations to keep them subtle and responsive.
Frequently Asked Questions
What is the recommended delay duration for the initial tooltip hover?
The emilkowalski/skills documentation recommends an initial delay of approximately 200–250 milliseconds. This brief pause filters out accidental cursor passes while maintaining the perception of a responsive interface. Shorter delays risk triggering tooltips during casual mouse movements, while longer delays can make the interface feel sluggish.
How do I prevent the animation from playing on subsequent tooltip hovers?
Apply a data-instant attribute to tooltip elements when a tooltip is already open in the same context. In your CSS, target this attribute with transition: none to eliminate both the fade and scale animations. This approach, as implemented in skills/emil-design-eng/SKILL.md, removes the 125 ms transition entirely, creating an instant appearance.
Should I reset the instant hover behavior when the mouse leaves the toolbar?
Yes. The recommendation specifies resetting your state tracking variable when the mouseleave event fires on the toolbar container, not individual buttons. This ensures that the next time the user approaches the toolbar after leaving it, they encounter the initial delay again, preventing accidental activations during subsequent visits.
Why not just use a shorter delay for all tooltips rather than making them instant?
A universal short delay would still introduce latency during rapid exploration of related controls. By making subsequent hovers instant, you maintain user flow and scanning speed without sacrificing the protective initial delay. The skills/review-animations/STANDARDS.md documentation explicitly notes this distinction as a way to make toolbars feel faster while preserving deliberation for first encounters.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →