2

I am implementing an IP address input field and I am wondering how it should work in right-to-left languages.

An IP address (IPv4 to be specific) is four integer numbers split with the dot character, e.g. 10.0.0.1. It is my understanding, that it is expressed and read left-to-right even in right-to-left languages, similar to a phone number.

I am implementing an input field where the user can only enter IP addresses. The only allowed characters are digits and a dot: "0123456789.", the platform is Android and I can set the on-screen-keyboard to be numeric.

My question is: which is more natural to a person using a right-to-left language: use the default RTL mode for the input field or force LTR?

1. Leave the input in RTL mode 2. Force LTR mode
1

"expressed and read left-to-right even in right-to-left languages, similar to a phone number"

More accurately, it's (mostly) pronounced LTR even in RTL languages, but it's read RTL even in LTR languages. :) That is, you can't begin reading from the left; you wouldn't know what place value the number has since places are counted based on their offset from the right. By contrast, the Roman numeral system can be read LTR since values are affected by characters to their left but not to their right.

But anyway... in Arabic, you input numbers LTR — you input the leftmost character first, according to this post. That is despite all other input being RTL.

Direction-switching is one of the harder things to get right with RTL languages, but it's a real thing (and there's even a Unicode character for switching the direction). Unfortunately, it's usually implemented haphazardly and can be extremely frustrating. In your two gifs above, the right one, with the input LTR, is much less frustrating because things don't swap order all the time. As a user, I can likely work with either system for numbers, as long as the order I see somehow corresponds to the order I typed.

So I recommend LTR.

1

In general, I would force LTR mode only if the only data in the field will be LTR. If there will be “mixed mode” (both LTR and RTL) data in the field, leave the input as RTL and let the standard input handler decide when to format as LTR.

0

Mixing modes is never good. If every other input field is implemented with rtl, so should this one.

1
  • Hi @ööö, thanks for joining the comuminity. Can you provide a rationale, specifically with regards to RTL/LTR, why you think mixing modes is not a good idea? Jul 21 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.