Expand description
The base direction of a text a user types: the direction its paragraph reads in, which decides where the text starts, where an empty field puts its caret, and which way a screen reader is told it runs.
A text input resolves it, every time it lays out, in this order:
- an explicit
TextBaseDirection::LeftToRightorTextBaseDirection::RightToLeft, used as given; - with
TextBaseDirection::Auto(the default), the first strongly directional character of the text (UAX #9, rules P2 and P3): Arabic text reads right to left, Latin text left to right, whatever the window’s direction; - when the text has none (it is empty, or only digits and punctuation),
the
content_languagedeclared on or above the field, throughLanguageTag::likely_direction; - with no language declared, the window’s layout direction.
So an empty field declared Arabic opens with its caret on the right, and a
field declared Japanese that holds Arabic text still reads right to left:
the language never decides against the text. This is HTML’s dir="auto",
falling back on the language before the surrounding direction.
Enums§
- Text
Base Direction - Which way a typed text’s paragraph reads. See the module for how a text input resolves it.