Skip to content

Commit

Permalink
Fix follow recommendation carrousel scrolling on RTL layouts, for real (
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored Oct 15, 2024
1 parent f2378ac commit 5e4cc1a
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 5e4cc1a

Please sign in to comment.