w3c / epub-specs

Shared workspace for EPUB 3 specifications.
Other
304 stars 60 forks source link

What should a RS do with CSS direction property? #1614

Closed iherman closed 3 years ago

iherman commented 3 years ago

§3.3.2 says:

  • It MAY include any CSS properties, with the following exceptions:
    • It MUST NOT use the direction property [CSS-Writing-Modes-3]. Use the [HTML] dir attribute to set the inline base direction.
    • It MUST NOT use the unicode-bidi property [CSS-Writing-Modes-3]. Use [HTML] bdo elements and dir attributes to control bidirectionality.

I am not 100% sure why this restriction is present. However, two questions do arise:

  1. What happens if I use SVG (which does not have a dir attribute, only language, or a bdo element)?
  2. What should be the behavior of a RS be if it finds one of these two properties (in HTML). Is it a "MUST ignore" ?
iherman commented 3 years ago

Whatever the decision for the RSS system is, I believe it is better to add this §4.3 of the RS spec.

dauwhe commented 3 years ago

I am not 100% sure why this restriction is present.

CSS advises people not to use direction with HTML documents:

Because HTML UAs can turn off CSS styling, we recommend HTML authors to use the HTML dir attribute and element to ensure correct bidirectional layout in the absence of a style sheet. Authors should not use direction in HTML documents.

Basically, fantasai told us never to use direction :)

iherman commented 3 years ago

But... do we allow RS-s to turn off CSS styling? Ie, is this relevant for us? (O.k., there are older RS-s that do not do CSS at all I guess...)

In any case, I believe this argument should be in the text because, at this moment, it really looks like a fairly ad-hoc constraint. Also, if I read the CSS text, it is a 'recommend' and not 'RECOMMEND'. In other words, we have made it a MUST NOT, which means RS-s have to check this, epubcheck have to test it, RS-s have to do something if it is violated, etc...

Wouldn't it be possible to change the text so that:

  1. we essentially take over (or link to) the CSS text pointing out that it is safer to use the HTML features (note, this is not possible in SVG, so this advise is only relevant for HTML)
  2. all this is put into an informative note rather than a normative restriction
dauwhe commented 3 years ago

But... do we allow RS-s to turn off CSS styling? Ie, is this relevant for us? (O.k., there are older RS-s that do not do CSS at all I guess...)

There was at least one prominent reading system years ago (Stanza) that completely ignored the author stylesheet.

EPUB already forbids this (and has since at least EPUB 3.0), in keeping with guidance from the CSS Working Group. EPUBCheck enforces this.

What is the benefit of relaxing this restriction, going against the advice of everyone who has ever looked at the issue? Is it worth changing the spec and changing EPUBCheck?

mattgarrish commented 3 years ago

What happens if I use SVG (which does not have a dir attribute, only language, or a bdo element)?

It has a direction attribute and unicode-bidi attribute with bidi-override value (presentation attributes directly mapped on the CSS properties).

Aren't those equivalent?

iherman commented 3 years ago

What happens if I use SVG (which does not have a dir attribute, only language, or a bdo element)?

It has a direction attribute and unicode-bidi attribute with bidi-override value (presentation attributes directly mapped on the CSS properties).

Aren't those equivalent?

Oops, I missed that! Then, even if we do not change the text, we would have to refer to those, too. The current text only refers to HTML.

iherman commented 3 years ago

What is the benefit of relaxing this restriction, going against the advice of everyone who has ever looked at the issue? Is it worth changing the spec and changing EPUBCheck?

Maybe not. But if we keep it as is (module the reference to the SVG things) then we have to specify what a RS has to do if and when it encounters such a value.

iherman commented 3 years ago

Is it worth changing the spec and changing EPUBCheck?

Actually... is this a testable assertion? It is, but it would require checking not only the validity of the CSS files (which, I presume, EPUBcheck does) but also analyzing the CSS files to detect the usage (or not) of these terms (which, I presume, EPUBcheck does not).

If my suspicion (ie, that EPUBCheck does not detect this) is correct, then a change would not affect any deployed EPUB instance.

@rdeltour ? @danielweck ?

rdeltour commented 3 years ago

@iherman EPUBCheck does report this as an error. See the test cases for CSS-001.

If it becomes a SHOULD in the spec, downgrading the severity is an easy change.

iherman commented 3 years ago

@rdeltour wow! I stand corrected...

iherman commented 3 years ago

The issue was discussed in a meeting on 2021-04-09

List of resolutions:

View the transcript ### 4. CSS Direction _See github issue [#1614](https://github.com/w3c/epub-specs/issues/1614)._ **Ivan Herman:** in the core spec, there is an item which says that RS must not use CSS features for direction and bidi: > Because HTML UAs can turn off CSS styling, we recommend HTML authors to use the HTML dir attribute and element to ensure correct bidirectional layout in the absence of a style sheet. Authors should not use direction in HTML documents. **Ivan Herman:** in the CSS documentation this is advice based on the fact that certain browsers may not implement CSS … core spec turns this into a MUST … should we depart from CSS spec in this way? … if we keep it as it is, then what should RS do if they do encounter CSS that uses these features? **Dave Cramer:** epub says that you can't use CSS direction since epub 3.0 … this is enforced in epubcheck … CSS group is very adamant that this is the wrong way to provide info about text direction … preferring use of HTML attribute dir … everyone seems happy with this state of things … understand that current language is slightly different from CSS, but i just don't see the value of changing this right now … there are other examples where epub spec has been more stringent than average … in terms of what RS should do if they see it, I think they should just follow the CSS … no special treatment necessary **Matt Garrish:** RS interop is critical, part of the rationale for having these requirements **Brady Duga:** this wasn't just fantasai's opinion, she was a representative of the CSS WG … also, if you use epubcheck as part of your ingestion pipeline, you might reject an epub if you include this sort of CSS **Ivan Herman:** currently the RS spec doesn't say anything about this, even though we so strongly say this in core … uncomfortable with the disconnect … also, the language needs to be updated to account for SVG **Dave Cramer:** comfortable with not putting any special requirements on RS when they see this **Garth Conboy:** could we acknowledge this in RS spec, and specifically say that an RS is able to do whatever it feels is appropriate? **Dave Cramer:** yes, I would agree > **Proposed resolution: Amend the RS section to allow RSs to do whatever they "damn well" please with CSS direction** *(Wendy Reid)* > *Tzviya Siegman:* +1 > *Garth Conboy:* +1 > *Deborah Kaplan:* +1 > *Ivan Herman:* +1 > *Charles LaPierre:* +1 > *Brady Duga:* Damn well +1 > *Wendy Reid:* +1 > *Matthew Chan:* +1 > *Dan Lazin:* +1 > *Bill Kasdorf:* +1 > *Gregorio Pellegrino:* +1 > *Ben Schroeter:* +1 > ***Resolution #2: Amend the RS section to allow RSs to do whatever they "damn well" please with CSS direction***
iherman commented 3 years ago

Closing by virtue of #1627 having been merged.

OriIdan commented 3 years ago

I never understood why not use CSS direction attribute. As someone who works with RTL languages all the time, the direction seems to me as belonging to CSS more then HTML so I am happy that W3C has decided to give both options. I don't see any reason why a RS should behave differently.

-- Ori Idan CEO Helicon Books http://www.heliconbooks.com

On Tue, Apr 6, 2021 at 11:56 AM Ivan Herman @.***> wrote:

§3.3.2 http://localhost:8001/LocalData/github/EPUB/epub-specs/epub33/core/#sec-css-req says:

  • It MAY include any CSS properties, with the following exceptions:
    • It MUST NOT use the direction property [CSS-Writing-Modes-3]. Use the [HTML] dir attribute to set the inline base direction.
    • It MUST NOT use the unicode-bidi property [CSS-Writing-Modes-3]. Use [HTML] bdo elements and dir attributes to control bidirectionality.

I am not 100% sure why this restriction is present. However, two questions do arise:

  1. What happens if I use SVG (which does not have a dir attribute, only language, or a bdo element
  2. What should be the behavior of a RS be if it finds one of these two properties (in HTML). Is it a "MUST ignore" ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/w3c/epub-specs/issues/1614, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB43QCBH65XUNNXZ4JX4CTTHLEC7ANCNFSM42OJTCXQ .