1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-23 22:56:20 +09:00

Fix follow recommendation carrousel scrolling on RTL layouts, for real (#32505)

This commit is contained in:
Claire 2024-10-15 11:38:04 +02:00 committed by GitHub
parent f2378aca40
commit 5e4cc1a39c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,8 +151,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]); }, [setCanScrollRight, setCanScrollLeft, bodyRef]);
const handleDismiss = useCallback(() => { const handleDismiss = useCallback(() => {