I’m building a web app, on an input text box I add dir=”auto” to autodetect the text direction and it works find both in Chrome and Firefox.
when I display that text later I use dir=”auto” in the container (p, span, etc..). it works fine in Chrome but the text is always displayed LTR in Firefox. (If I change it manually to dir=”rtl” it works in Firefox, but I want it to be automatic)
how can I fix this ?
Unfortunately, Firefox (Gecko) does not support the HTML5 dir attribute properly, which specifies the element’s text directionality. This is a known bug and has been marked resolved on 2012-11-26.
It will be implemented within Firefox20 (Milestone). Firefox20 moves to BETA on Week of 2013-02-18.
You can detect the client’s default dir attribute by using gecko’s
document.defaultView(MDN):