Last modified: 2012-12-13 11:20:57 UTC
Created attachment 11109 [details] a screenshot showing the problem The description input field has LTR directionality even when my language is Hebrew. It is correctly assigned lang="he", but it must also have explicit dir="rtl" accordingly. (And dir="ltr" for ltr languages.)
I thinkdir="auto" only works for presentation, so it will be no easy solution here.
This should work according to W3C. "Use dir="auto" on forms and inserted text in order to automatically detect the direction of content supplied at run-time. Consider using the dirname attribute on forms to send information about direction in addition to the usual form data." http://www.w3.org/International/tutorials/new-bidi-xhtml/qa-html-dir
As far as I understand, this description is supposed to be written in each language, so the correct language and directionality must be assigned. If lang="he" can be assigned to that element, assigning the correct dir is very easy using the Language::getDir() method.
Seems like we hit some nasty styling that interferes with language direction set on each input element. .sitedir-ltr textarea, .sitedir-ltr input { direction: ltr; }
Yes, it defines the default, and it makes sense, at least in the current way MediaWiki is built. But it's easy to override it.
Yes. The reason why I posted it here is that we made some very rudimentary checking about how to fix this, and use of dir="auto" failed, but with this styling our test results could be wrong.
There's no reason to even consider dir="auto" when the language is known.
Even if we could assume a label/description to always be according to the given language, which I think we can't, we should still consider dir="auto" because its implications as a more lightweight solution. If not we must most likely either change language caching or do our own caching. The language cache is purged when it reaches 10 entries, while we can have up to several hundred languages on one page. The problem comes from the sitelink table on the item page. Anyhow, I think it is sufficient for now. Thanks for the additional points.
dir="auto" doesn't make a lot of sense on an input box. It's for static text. If we can't assume that the description is in the given language, then why is the lang attribute assigned to it? Is a description written in every language or only in one language?
So for descriptions and labels input boxes we set the directionality attributes accordingly to the language. Avoid "auto" as it does not seem to be there yet.
For reference: http://www.w3.org/International/questions/qa-bidi-css-markup
Appears to work correctly in the current test site.