999 Design Tips · 025 选用正确的延时,让你的悬停与切换更加人性化 悬停延时的核心,是根据「用户意图」动态响应: 1. 组内“热启动”(工具栏、头像组) 首次悬停设 300–500ms 延时,防止光标路过时闪出一排 Tooltip;一旦触发首个,说明用户进入浏览状态,组内连续切换应 0ms 即时显示。 2. 移入容错(下拉菜单、资料卡) 触发器与浮层的缝隙需加透明桥接区,防止半路断触;光标移出浮层保留 150–300ms 缓冲,避免光标抖动或移速过快打断操作。 3. 按体量定快慢 遮挡面积越大、信息越重(如预览大卡),触发延时应越久(500ms+);单行轻量提示则可更快响应。 4. 级联防误触(多级菜单) 途经其他选项时需加 150–250ms 切换延时,避免光标斜向移往子菜单时误切浮层。更丝滑的做法是加入「安全三角区」,详见我的教程 02 期。 附带一个 Prompt,可基于这套规则帮你快速排查与优化悬停交互,直接抄 ⬇️ https://vibedesign.tips/
枯白啃设计

图标设计师 / 设计工程师

Prompt(2/2) 2. Reading the pointer - Keep the pointer's last few positions and work out its speed over the last 90ms. It is moving fast above about 0.1px per ms (10px in 100ms); below that it is slowing down or resting. - Waiting to open: the timer starts when the pointer enters a trigger and starts again whenever it enters another one, so a pointer passing over a row of triggers opens nothing. - Swapping while open: another trigger takes the open card or preview only after the pointer has been slow on it for about 60ms (about 100-150ms after it stops). Triggers crossed fast are passed over. - When the panel sits to one side and the person may move at an angle across other triggers, the speed check is usually enough. If it is not, add a safe triangle from the pointer to the panel's near edge, as for cascading menus. - All timers run on one clock, are cancelled when the pointer moves on, and are cleared when the component unmounts. Only one overlay of each kind is open at a time. 3. Rules for every one - Motion: a label fades in over about 140ms and out over 60ms; a card fades in with a 4px drop over about 200ms and out over 120ms; a preview fades in with an 8px slide over about 250ms and out over 140ms. Swaps in place cross-fade over about 200ms. Closing is always faster than opening. - Nothing around the trigger moves when an overlay opens or closes. - Keyboard: focus on a trigger shows its label at once; a card or preview opens on Enter or after the same delay as hover; Escape closes it and returns focus to the trigger. Labels are linked with aria-describedby. - Touch has no hover. Under @media (hover: none), labels show on long press or as visible text, and cards and previews open on tap. Keep :hover styles inside @media (hover: hover), so a tapped button does not stay in its hover look. - Reduced motion: no drop, slide or scale; fades only. - If the product uses a library, set its own options rather than adding timers next to it. For example: Radix Tooltip.Provider delayDuration 500 and skipDelayDuration 400; Radix HoverCard openDelay 700 and closeDelay 300; Floating UI useHover with delay { open, close } and handleClose: safePolygon() for cards and previews, and useDelayGroup for labels. 4. The report Before changing anything, give me one table, one row per place: | Place | Kind (label, card, preview, or click instead) | Today (open delay, close, gap, moving to the next) | Problem | Change | Values | Then list the shared changes (a hover-intent helper, the library settings) separately from the per-place ones. Ask me which rows to change, and change only those. 5. Check the result - Sweeping the pointer across a toolbar opens no labels; resting on one opens it after 500ms; moving along the toolbar changes it at once, in place, with no flicker; leaving for more than 400ms brings the wait back. - A card opens after 700ms, and the pointer can cross the gap and press a button inside it. Slipping out of the card and back within 300ms keeps it open. - Moving at an angle from a list to its preview, across other rows, never changes the preview. Resting on another row swaps it in place, without closing. - Touch and keyboard reach everything that hover reaches.
登录并发表评论

评论 · 0