Fix pet carousel: selection stuck, border clipped on hover - #24
Conversation
…over Selection was driven entirely by an IntersectionObserver that only updates on an actual scroll change. On wider viewports where every card is already visible, clicking a card calls scrollIntoView on an already-in-view target, which is a no-op — so the observer never re-fires and the click silently does nothing, leaving whatever card was last scrolled to permanently selected. Clicking now sets the selection directly instead of relying solely on scroll-triggered centering. Also the scroll strip had bottom padding but none on top, so a hovered card's lift transform pushed its rounded border past the container's clip boundary and got sliced off.
The latest updates on your projects. Learn more about Vercel for GitHub.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe pet carousel now updates the selected pet immediately when a card is clicked. The centering hook exposes its setter. Card styling, focus states, hover states, and spacing are updated. ChangesPet carousel selection
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Merge Risk:⚪ Minimal · up to This localized change directly updates carousel selection on click and adds spacing to prevent hover-border clipping; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
User description
Summary
scrollIntoView). On wider viewports where every card is already fully visible,scrollIntoViewon an already-in-view card is a no-op, so theIntersectionObserver-driven selection state never updated — clicks silently did nothing, and whatever card was last scrolled to stayed selected permanently.pb-2) but no top padding, so the hover lift transform pushed the card's rounded border past the container's clip boundary.Test plan
tsc --noEmitpassesGenerated description
Below is a concise technical summary of the changes proposed in this PR:
Fix dashboard pet carousel selection by exposing
setCenteredIdfromuseCenteredCardand applying it directly on card clicks, while preserving observer-based swipe selection. Add top padding and restructure card styling to prevent hover borders from being clipped.Modified files (1)
Latest Contributors(2)
PetsCarouselto select clicked pets immediately regardless of scrolling, while retaining smooth centering and observer-driven swipe behavior.Modified files (2)
Latest Contributors(2)
Summary by CodeRabbit
Bug Fixes
Style