Automatic text direction detection for input fields in the admin area
|Reported by:||johnbillion||Owned by:|
When the WordPress admin area is displayed in a left-to-right language (such as English), any text in a right-to-left language (such as Arabic) will not be displayed correctly in input fields due to the incorrect text direction, and vice versa for left-to-right text displayed in right-to-left inputs.
This can be a significant problem not only for multilingual websites, but also for sites where users are using the admin area in a language with a text direction opposite to the content they're editing, or indeed any site which has published any content in a language that uses the opposite text direction.
After some discussion at WordCamp London with @s1m0nd, @swissspidy, and @shadyvb, it was decided that input fields across the whole of the WordPress admin area should detect the direction of the text contained within them and switch the text direction of the input field on the client side automatically.
An example of this in action is on google.com, where the main search input field automatically switches direction as soon as you input the first character. This is the desired behaviour. @shadyvb has some experience implementing this already. The text direction of a character is detectable based on the right-to-left unicode range(s).
The same problem also extends to output of user-defined content that doesn't appear in an input field, for example category names in the Categories meta box, user display names, and comments on the Comments screen, but this may be more complicated to implement so is best approached in a follow-up ticket.
Adding the accessibility keyword as there may be some Aria live requirements around switching an input's text direction on the fly.
QUnit tests for the functionality would be desirable.