Conversation
pointer: coarse 대신 pointer: fine을 사용하여 with-interaction 정책과 일관성 유지하고 pointer: none 디바이스도 올바르게 처리 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review Walkthrough토스트의 디바이스 감지 헬퍼가 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
size-limit report 📦
|
🚀 Preview
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/wds/src/components/toast/hooks.ts (1)
81-103:handleMouseLeave에도 동일한isCursorDevice()가드 추가를 고려해 주세요.
handleMouseEnter에는isCursorDevice()가드가 추가되었지만,handleMouseLeave에는 없습니다. 터치 디바이스에서mouseleave이벤트가 발생할 경우:
handleMouseEnter가 가드에 의해 타이머를 클리어하지 않음handleMouseLeave가startTimer(remainingTimeRef.current)를 호출- 기존 타이머가 실행 중인 상태에서 새 타이머가 생성될 수 있음
발생 가능성은 낮지만, 일관성과 방어적 코딩을 위해
handleMouseLeave에도 가드를 추가하는 것이 안전합니다.♻️ 제안하는 수정
const handleMouseLeave = () => { - if (open && remainingTimeRef.current !== undefined) { + if (isCursorDevice() && open && remainingTimeRef.current !== undefined) { // Restart timer with remaining time startTimer(remainingTimeRef.current); } };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/wds/src/components/toast/hooks.ts` around lines 81 - 103, The handleMouseLeave should mirror the cursor-device guard used in handleMouseEnter to avoid restarting timers on touch devices; update handleMouseLeave to first check isCursorDevice() (and the existing open && remainingTimeRef.current !== undefined) before calling startTimer(remainingTimeRef.current), ensuring you only restart the timer on pointer/cursor devices and prevent creating duplicate timers; reference symbols: handleMouseLeave, handleMouseEnter, isCursorDevice, startTimer, remainingTimeRef, open.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/wds/src/components/toast/hooks.ts`:
- Line 83: The global matchMedia mock causes isCursorDevice() to always return
false, breaking hover-pause logic; fix by making the global mock return matches:
true for the '(pointer: fine)' query or override matchMedia within the failing
test to return matches: true for '(pointer: fine)'. Locate usage of
isCursorDevice() in packages/wds/src/components/toast/hooks.ts and update the
test setup in .vitest/setup-tests.ts (or the specific test file) so
window.matchMedia('(pointer: fine)') yields matches: true, ensuring the
mouseEnter handler triggers clearTimer() and the hover pause behavior is
properly validated.
---
Nitpick comments:
In `@packages/wds/src/components/toast/hooks.ts`:
- Around line 81-103: The handleMouseLeave should mirror the cursor-device guard
used in handleMouseEnter to avoid restarting timers on touch devices; update
handleMouseLeave to first check isCursorDevice() (and the existing open &&
remainingTimeRef.current !== undefined) before calling
startTimer(remainingTimeRef.current), ensuring you only restart the timer on
pointer/cursor devices and prevent creating duplicate timers; reference symbols:
handleMouseLeave, handleMouseEnter, isCursorDevice, startTimer,
remainingTimeRef, open.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: db28a3e5-6955-4031-bbf3-eb68e4b8bea7
📒 Files selected for processing (2)
packages/wds/src/components/toast/helpers.tspackages/wds/src/components/toast/hooks.ts
cursor device 여부에 따른 hover 동작을 명시적으로 검증하고 non-cursor device에서 토스트가 정상 닫히는 테스트 케이스 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
pointer: coarse대신pointer: fine미디어 쿼리를 사용하여 커서 디바이스 판별 로직 개선with-interaction컴포넌트의@media not (pointer: fine)정책과 일관성 유지Changes
isNotPointerDevice()→isCursorDevice()로 함수명 및 로직 변경(pointer: coarse)체크 → 터치 디바이스에서 hover 시 타이머 일시정지가 동작하여 토스트가 안 닫힘(pointer: fine)체크 → 마우스/트랙패드에서만 hover 일시정지 동작,pointer: none디바이스도 올바르게 처리Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
릴리스 노트