fix(DomeGallery): Resolve mobile tap/touch conflict and sizing animation across all variants #582
+137
−139
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #559
Description of the Fix
This Pull Request resolves the critical mobile bug in the
<DomeGallery />
component where a tap on an image tile would often fail to trigger the image enlargement animation or result in incorrect final sizing.Root Cause and Solution
The issue stemmed from a conflict in event handling:
Root Cause: The image tile elements had redundant native event handlers (
onClick
,onTouchEnd
) which competed with the comprehensive drag and tap detection logic provided by the@use-gesture/react
library on the main container. On mobile, a quick tap is often registered as a slight drag, causing the native events to be cancelled, breaking the animation flow.Solution:
onClick
,onPointerUp
, andonTouchEnd
handlers from the individual image tile JSX elements.useGesture
hook on the main container (mainRef
). This hook reliably distinguishes between a drag (for rotation) and a clean tap (to callopenItemFromElement
), ensuring consistent behavior across all devices.Compliance and Verification
All 4 Variants Updated: As required by the contribution guidelines, this fix has been applied to all four component variants:
src/content/Components/DomeGallery/DomeGallery.jsx
src/tailwind/Components/DomeGallery/DomeGallery.jsx
src/ts-default/.../DomeGallery.tsx
)src/ts-tailwind/.../DomeGallery.tsx
)Local Testing: Confirmed functionality on desktop (drag/click) and mobile (swipe/tap). No console errors.
Proof/Testing
The video below demonstrates the successful execution of the enlargement animation after the fix is applied.
domereactbits.mp4