Issue metadata
Sign in to add a comment
|
<div> doesn't support 'auto' direction per line. |
||||||||||||||||||||||
Issue descriptionWhat steps will reproduce the problem? See https://jsfiddle.net/sr2ja8h8/ or alternatively follow instructions below. (1) Have a <div> element with dir='auto'. (2) In that <div> element, create a child <div> element with nothing set to its dir attribute. (3) Have LTR language in the parent <div> (4) Have RTL language in the child <div>. (5) Notice that the first line "HELLO WORLD" is in LTR direction. (6) The second line which is in a RTL language (Hebrew) is also LTR What is the expected output? I expected the second line to be in RTL direction. What do you see instead? The second line is in LTR direction. It feels even more unexpected in a contentEditable element where you type English, press Enter, then type in Hebrew.
,
Oct 29 2016
Filed https://bugs.chromium.org/p/chromium/issues/detail?id=660619
,
Oct 30 2016
,
Oct 31 2016
Sample in #1 isn't editable. It seems editability doesn't affect this issue.
,
Oct 31 2016
Issue 660619 has been merged into this issue.
,
Oct 31 2016
I admit that I'm only 80% certain, but this looks like a by design to me. If you think I'm wrong, it'd be helpful to point me a link to spec that supports your expectations. dir="auto" resolves to the first character, so LTR in this case. And since dir attribute inherits, the base direction of the 2nd div is still LTR. From my best guess, what you want for your use case is probably not dir="auto", but "unicode-bidi: plaintext": https://drafts.csswg.org/css-writing-modes-3/#valdef-unicode-bidi-plaintext Remove dir="auto", and add this CSS (unicode-bidi does not inherit): div { unicode-bidi: -webkit-plaintext; /* WebKit does not support unprefixed yet */ unicode-bidi: plaintext; } But I recommend you to double-check the expected behavior with more bidi experts. dir=auto is designed this way intentionally, because that's what authors want in most cases. "unicode-bidi: plaintext" exists to support other, rarer use cases, and I can't determine which behavior is more appropriate for your use case from the description. In most cases, the base direction is expected to be given explicitly. In case it is not easy, dir=auto gives so-so good heuristics. "unicode-bidi: plaintext" flips to a different heuristics logic for a specific case. But explicit base direction is always most desired, and using "unicode-bidi: plaintext" will ignore it, so please use it in caution. https://www.w3.org/International/articles/inline-bidi-markup/uba-basics#base_dir_scope
,
Nov 2 2016
,
Jan 4 2017
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by samsmlee@google.com
, Oct 29 2016