views:

447

answers:

3

I'm working with right-to-left layouts at the moment (think Hebrew or Arabic). In RTL, the page is generally flipped horizontally. However, I can't figure out how to change the orientation of the scrollbars. I would assume that the scrollbars should appear on the left side of a scrollable element, not the right side like it does in an LTR layout.

Here is an example page where the scrollbar still appears on the right:

<html dir="rtl">
<body>
<div style="height: 100px; overflow: auto;">
    <p>This is some text</p>
    <p>This is some text</p>
    <p>This is some text</p>
    <p>This is some text</p>
    <p>This is some text</p>
</body>
</html>

Is the orientation of a scrollbar a browser locale setting, and thus is not something I should be concerned about, or is there a way to set the orientation of the scrollbar?

(I'm not interested in implementing my own JavaScript scrollbar; if it turns out this is just a limitation of browsers then I'd rather live with that than add complexity to the page.)

A: 

You can add the dir attribute to the body tag like so:

<body dir="rtl">

The catch is that the behaviour is erratic in different browsers. Most newer browser will flip the content from right to left as you'd expect, but only IE and Opera also move the scrollbar to the left side.

Pat
A: 

I don't think it's a good idea to do this, I'm an Arab myself and I find it really annoying when the scrollbars are on the left.

Waleed Eissa
Do you know of any good resources which explain what people in RTL locales expect? That's a bigger overall problem - knowing what is desired in the first place.
Daniel Lew
I'm sorry I don't know of any resources that discuss this, also, google didn't return much about it. But anyway, what I can say is that it's not good to be done 'per window'. In other words if the user is using mirroring (I'm referring to the settings of their OS), then you don't need to do anything as the user already chose what they want. But if the user is not using mirroring, it means they have the scrollbars on the right for all windows, and it gets really annoying when they have a window with scrollbars on the left. It should be left to the OS settings.
Waleed Eissa
I'm not completely sure but I think the majority of Arabic speakers don't use mirroring anyway, this is esp. true for Windows XP and Vista. Well, at least none of the people I know use it.
Waleed Eissa
+1  A: 

There is no standard way to flip the side of the page scrollbars, because it is an UI element while you can control only the page content (HTML).

Tomer Cohen