Skip to content

Commit

Permalink
[Glitch] Fix follow recommendation carrousel scrolling on RTL layouts…
Browse files Browse the repository at this point in the history
…, for real

Port 70472de to glitch-soc

Signed-off-by: Claire <[email protected]>
  • Loading branch information
ClearlyClaire committed Oct 15, 2024
1 parent 8b6247c commit 9b6f92e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,13 @@ export const InlineFollowSuggestions = ({ hidden }) => {
return;
}

setCanScrollLeft(bodyRef.current.scrollLeft > 0);
setCanScrollRight((bodyRef.current.scrollLeft + bodyRef.current.clientWidth) < bodyRef.current.scrollWidth);
if (getComputedStyle(bodyRef.current).direction === 'rtl') {
setCanScrollLeft((bodyRef.current.clientWidth - bodyRef.current.scrollLeft) < bodyRef.current.scrollWidth);
setCanScrollRight(bodyRef.current.scrollLeft < 0);
} else {
setCanScrollLeft(bodyRef.current.scrollLeft > 0);
setCanScrollRight((bodyRef.current.scrollLeft + bodyRef.current.clientWidth) < bodyRef.current.scrollWidth);
}
}, [setCanScrollRight, setCanScrollLeft, bodyRef]);

const handleDismiss = useCallback(() => {
Expand Down

0 comments on commit 9b6f92e

Please sign in to comment.