Improve video scrolling by preventing default event propagation
This commit modifies the scroll buttons within the `netflix-grid.tsx` component to include `e.preventDefault()` and `e.stopPropagation()` calls on click and mouse events. This prevents default browser behavior and stops event bubbling, ensuring smoother scrolling and avoiding unintended interactions when navigating video categories. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/QCN70f2
This commit is contained in:
parent
74daa5f04c
commit
59d5115a45
@ -203,9 +203,19 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
||||
<div className="relative">
|
||||
{/* Left scroll button - positioned at video thumbnail center */}
|
||||
<button
|
||||
onClick={() => scroll('left')}
|
||||
onMouseEnter={() => startAutoScroll('left')}
|
||||
onMouseLeave={stopAutoScroll}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
scroll('left');
|
||||
}}
|
||||
onMouseEnter={(e) => {
|
||||
e.stopPropagation();
|
||||
startAutoScroll('left');
|
||||
}}
|
||||
onMouseLeave={(e) => {
|
||||
e.stopPropagation();
|
||||
stopAutoScroll();
|
||||
}}
|
||||
className="hidden md:flex absolute left-2 top-[45%] -translate-y-1/2 w-12 h-12 z-30 bg-black/80 hover:bg-black/95 rounded-full items-center justify-center transition-all duration-300 cursor-pointer border border-white/30 shadow-lg"
|
||||
data-testid="button-scroll-left"
|
||||
>
|
||||
@ -214,9 +224,19 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
||||
|
||||
{/* Right scroll button - positioned at video thumbnail center */}
|
||||
<button
|
||||
onClick={() => scroll('right')}
|
||||
onMouseEnter={() => startAutoScroll('right')}
|
||||
onMouseLeave={stopAutoScroll}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
scroll('right');
|
||||
}}
|
||||
onMouseEnter={(e) => {
|
||||
e.stopPropagation();
|
||||
startAutoScroll('right');
|
||||
}}
|
||||
onMouseLeave={(e) => {
|
||||
e.stopPropagation();
|
||||
stopAutoScroll();
|
||||
}}
|
||||
className="hidden md:flex absolute right-2 top-[45%] -translate-y-1/2 w-12 h-12 z-30 bg-black/80 hover:bg-black/95 rounded-full items-center justify-center transition-all duration-300 cursor-pointer border border-white/30 shadow-lg"
|
||||
data-testid="button-scroll-right"
|
||||
>
|
||||
@ -225,14 +245,22 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
||||
|
||||
{/* Mobile scroll buttons */}
|
||||
<button
|
||||
onClick={() => scroll('left')}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
scroll('left');
|
||||
}}
|
||||
className="md:hidden absolute left-1 top-[45%] -translate-y-1/2 w-10 h-10 z-40 bg-black/80 rounded-full flex items-center justify-center border border-white/30 shadow-lg"
|
||||
data-testid="button-mobile-scroll-left"
|
||||
>
|
||||
<ChevronLeft className="w-5 h-5 text-white" />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => scroll('right')}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
scroll('right');
|
||||
}}
|
||||
className="md:hidden absolute right-1 top-[45%] -translate-y-1/2 w-10 h-10 z-40 bg-black/80 rounded-full flex items-center justify-center border border-white/30 shadow-lg"
|
||||
data-testid="button-mobile-scroll-right"
|
||||
>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user