Fix follow recommendation carrousel scrolling on RTL layouts (#32462)

This commit is contained in:
Claire 2024-10-14 17:25:32 +02:00 committed by GitHub
parent ffa1032381
commit 7c10b0fb7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -129,8 +129,13 @@ export const InlineFollowSuggestions = ({ hidden }) => {
return; return;
} }
setCanScrollLeft(bodyRef.current.scrollLeft > 0); if (getComputedStyle(bodyRef.current).direction === 'rtl') {
setCanScrollRight((bodyRef.current.scrollLeft + bodyRef.current.clientWidth) < bodyRef.current.scrollWidth); 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]); }, [setCanScrollRight, setCanScrollLeft, bodyRef, suggestions]);
const handleLeftNav = useCallback(() => { const handleLeftNav = useCallback(() => {