Skip to content

Commit aa24430

Browse files
committed
Results: Fix scroll snapping on mobile (and Firefox)
For mobile, we want the snapping x to be mandatory. However, that breaks scroll-y on Firefox which requires proximity. This is something tailwind does not allow right now, so we use some custom css here.
1 parent cff0519 commit aa24430

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/components/Scenes/Results/Results.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const Results: React.FC<Props> = ({
1616
const resultItems = results?.data?.items || []
1717

1818
return (
19-
<div className="z-0 flex h-full flex-grow snap-both snap-proximity flex-row overflow-scroll overscroll-contain">
19+
<div className="snap-x-not-y z-0 flex h-full flex-grow flex-row overflow-scroll overscroll-contain">
2020
{resultItems.map((scene, index) => (
2121
<ResultColumn
2222
category={category}

src/styles/global.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,10 @@
1414
@apply text-slate-800;
1515
}
1616
}
17+
18+
@layer components {
19+
.snap-x-not-y {
20+
scroll-snap-type: x mandatory;
21+
scroll-snap-type: y proximity;
22+
}
23+
}

0 commit comments

Comments
 (0)