Skip to content

Commit

Permalink
Fix follow recommendation carrousel scrolling on RTL layouts (mastodo…
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored Oct 14, 2024
1 parent ffa1032 commit 7c10b0f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,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, suggestions]);

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

0 comments on commit 7c10b0f

Please sign in to comment.