And finally, inline, flex and grid flows will flip according to page direction. All of this happens because when the dir attribute was first incorporated into HTML 4.0 back in the late 90s when we had versions of HTML, it came with a design philosophy that the layout direction was considered a content property, not a presentational concern. So while you can achieve the same effects with the direction property in CSS, we never use this at DeepL because it's generally not recommended.
The idea is that this information should remain in the markup, not the stop sheet. This gets more complicated at DeepL because we deal with mixed content on the page. A user might be using the application in one language while translating text into a language with the opposite direction. There are at least 4 different states, UI in English translating to Arabic, UI in English translating from Arabic, UI in Arabic translating to other languages and the opposite. So we relied on the global direction attribute as much as possible, but since this attribute can be set on any subset of markup in the HTML document, we can override it in our interface to accommodate these different states.
This reinforces the idea that text direction isn't just a style sheet preference. It's baked into the fundamental structure of the writing systems we are displaying at any given time and is right in the Unicode characters. Our goal was to allow developers to write direction agnostic styles that automatically adapt based on the nearest dir attribute. So, how do we do that? Well, for starters, floats, absolute, fixed positions, margin, and padding all need to be rewritten using direction agnostic properties. These declarations were not originally designed with bi-directionality in mind, and used physical values, left, right, top, and bottom, rather than logical values, start, end, inline, and block.
Comments