File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 202202 } , { passive : true } ) ;
203203
204204 // Handle touch end for swipe or tap
205+ // Note: passive:false allows us to preventDefault on tap/swipe while still allowing vertical scrolling
205206 card . addEventListener ( 'touchend' , ( e ) => {
206207 // Only handle touches on the card-code area
207208 if ( ! e . target . closest ( '.card-code' ) ) return ;
218219 const isHorizontalSwipe = absDeltaX > 50 && absDeltaX > absDeltaY ;
219220
220221 if ( isHorizontalSwipe ) {
221- // Prevent default navigation
222+ // Prevent default navigation for horizontal swipes
222223 e . preventDefault ( ) ;
223224 // Swipe left = show modern, swipe right = show old
224225 if ( deltaX < 0 ) {
233234 e . preventDefault ( ) ;
234235 card . classList . toggle ( 'toggled' ) ;
235236 }
237+ // Note: Vertical scrolling (large deltaY, small deltaX) doesn't call preventDefault
236238 } , { passive : false } ) ;
237239
238- // Prevent click events on card-code from navigating
239- // (the touch handlers above already handle the interaction)
240+ // Prevent click events on card-code from navigating (touch devices only)
241+ // This is a safety net in case touch events trigger click as fallback
240242 card . addEventListener ( 'click' , ( e ) => {
241243 if ( e . target . closest ( '.card-code' ) ) {
242244 e . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments