This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16456 - direction property should support auto as a value
Summary: direction property should support auto as a value
Status: RESOLVED WONTFIX
Alias: None
Product: CSS
Classification: Unclassified
Component: Writing Modes (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: fantasai
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-20 19:10 UTC by Ryosuke Niwa
Modified: 2012-03-29 21:51 UTC (History)
3 users (show)

See Also:


Attachments

Description Ryosuke Niwa 2012-03-20 19:10:34 UTC
Right now, dir=auto doesn't have a css equivalent. This is inconvenient for authors who want to control the directionality of the text via CSS, and also cumbersome for implementors because we have to support pseudo style resolution just for this one attribute.
Comment 1 fantasai 2012-03-29 18:29:14 UTC
This is as designed.
  1. You should not be using CSS to set bidi properties. Base directionality
     is a content property, not a stylistic one.
  2. The 'direction' property inherits and its computed value must be either
     'ltr' or 'rtl' in order for various layout calculations to be well-defined.

Note: In the future, please file issues against CSS by posting to www-style as requested in the status sections of the drafts.
Comment 2 Ryosuke Niwa 2012-03-29 18:37:59 UTC
Why did we add unicode-bidi: isolate, plaintext, etc... then?
Comment 3 fantasai 2012-03-29 19:23:01 UTC
(In reply to comment #2)
> Why did we add unicode-bidi: isolate, plaintext, etc... then?

To support the HTML spec's bidi features, because bidi reordering is defined at the CSS layer.
Comment 4 Amir E. Aharoni 2012-03-29 19:29:55 UTC
You should not be using CSS to set bidi properties.(In reply to comment #3)
> (In reply to comment #2)
> > Why did we add unicode-bidi: isolate, plaintext, etc... then?
> 
> To support the HTML spec's bidi features, because bidi reordering is defined at
> the CSS layer.

Like Ryosuke, i don't understand this. bidi reordering is defined at the CSS layer, but one should not be using CSS to set bidi properties. Some bidi features are accessible through CSS and some aren't.

I keep hearing the "CSS shouldn't be used for bidi" mantra, but i never heard a proper explanation for it. This bug report is probably a bad place to discuss it, but i couldn't find anything better.
Comment 5 Ryosuke Niwa 2012-03-29 19:32:51 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Why did we add unicode-bidi: isolate, plaintext, etc... then?
> 
> To support the HTML spec's bidi features, because bidi reordering is defined at
> the CSS layer.

But unicode-bidi: isolate and unicode-bidi: plaintext are as semantically important as dir=ltr or dir=rtl. Isn't that precisely why we have bdi? Why did we permit bdi to have a CSS equivalent but not dir=auto? What's the justification for that?
Comment 6 fantasai 2012-03-29 21:51:15 UTC
The fact that bidi can be controlled via CSS is a glitch in the way CSS was defined, and it's a result of people in the past wanting to apply bidi controls to arbitrary XML. They should have defined an xml:dir attribute instead.

CSS is for styling, not for defining content. A document should still be understandable if the CSS is turned off, if viewed in a browser that supports HTML but not CSS. By shifting bidi controls into the CSS layer, you lose ordering information that is critical for presenting the text, without which the text itself can be garbled inasmuch as as applying the wrong encoding.

Furthermore, bidi is based on the content, not on the styling intent. If you change the content, the directionality controls need to be updated to match. If you change the styling... the directionality controls need to stay the same. No matter how much you change the styling, the bidi controls always stay the same. But if you change the content, the bidi code might need to change. They are tied to, and therefore belong with, the content, not with the style.

Now, selectors are a very convenient way of tying properties to elements. But the scope of CSS is defined by the scope of styling, not by the scope of things-that-are-conveniently-applied-with-selectors. Otherwise we'd allow binding event handlers in CSS, which would also be conveniently applied with selectors. It might be convenient to bind bidi controls to elements via selectors. But it is not an argument for them belonging in CSS.

> But unicode-bidi: isolate and unicode-bidi: plaintext are as semantically
> important as dir=ltr or dir=rtl.

"unicode-bidi: isolate" does not confer semantics any more than "display: table" does. The semantics are conferred by HTML. The CSS values are only provided so that the HTML definitions can be reflected in the CSS rendering model. The features provided by 'unicode-bidi: isolate' and 'unicode-bidi: plaintext' are important, yes, but that's why the HTML spec has <bdi> and <pre dir=auto>.