W3C home > Mailing lists > Public > www-style@w3.org > August 2012

[cssom-view] value of scrollLeft in RTL situations is completely busted across browsers

From: Robert O'Callahan <robert@ocallahan.org>
Date: Mon, 6 Aug 2012 23:07:10 +1200
Message-ID: <CAOp6jLZYfkSPgh4L6VYUaA=40=yZ9HiFLtuujeF0de91zYTJ3w@mail.gmail.com>
To: www-style <www-style@w3.org>
How should scrollLeft work with RTL? There are some major differences
across browsers.
http://people.mozilla.org/~roc/test_rtl_scrollLeft.html
Try scrolling the elements and clicking in them.

In Gecko nightly, scrollLeft=0 corresponds to the rightmost scrolled
position and increases from left to right (so scroll positions are
negative). Opera seems to behave the same way.

Chrome (22 dev) behaves the same way when scrolling the viewport (for both
toplevel documents and iframes). Unfortunately scrolling a regular element
works quite differently: scrollLeft=0 corresponds to the leftmost scroll
position (but still increases to the right).

In IE9, scrollLeft=0 corresponds to the rightmost scrolled position but
scrollLeft increases as you scroll from right to left!

I'm unsure which behavior is best. I think most Web content I've seen that
uses scrollLeft assumes its minimum value is zero and it increases from
left to right, because of course that's how LTR behaves. Unfortunately
that's almost the least popular option in implementations. I'm considering
changing Gecko to do it that way for RTL anyway. AFAIK the main
disadvantage of that approach (other than being a behavior change) is that
you lose the ability to easily scroll "to the start" by setting scrollLeft
to 0. Then again, I haven't noticed people trying to do that on the
horizontal axis.

Any thoughts, before I go ahead? :-)

Rob
-- 
“You have heard that it was said, ‘Love your neighbor and hate your enemy.’
But I tell you, love your enemies and pray for those who persecute you,
that you may be children of your Father in heaven. ... If you love those
who love you, what reward will you get? Are not even the tax collectors
doing that? And if you greet only your own people, what are you doing more
than others?" [Matthew 5:43-47]
Received on Monday, 6 August 2012 11:07:43 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT