@@ -343,6 +343,9 @@ export default function createGridComponent({
343343 const { scrollLeft , scrollTop , scrollUpdateWasRequested } = this.state;
344344
345345 if (scrollUpdateWasRequested && this . _outerRef != null ) {
346+ // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
347+ // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
348+ // So we need to determine which browser behavior we're dealing with, and mimic it.
346349 const outerRef = ( ( this . _outerRef : any ) : HTMLElement ) ;
347350 if ( direction === 'rtl' ) {
348351 const isNegative = isRTLOffsetNegative ( ) ;
@@ -728,8 +731,9 @@ export default function createGridComponent({
728731 const isNegative = isRTLOffsetNegative ( ) ;
729732
730733 // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
731- // Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).
732- // See https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
734+ // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
735+ // It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
736+ // So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.
733737 if ( isNegative ) {
734738 calculatedScrollLeft = - scrollLeft ;
735739 } else {
0 commit comments