Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
iherman opened this issue Apr 6, 2021 · 13 comments
Closed

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

iherman opened this issue Apr 6, 2021 · 13 comments
Labels
EPUB33 Issues addressed in the EPUB 3.3 revision Spec-ReadingSystems The issue affects the EPUB Reading Systems 3.3 Recommendation Topic-ContentDocs The issue affects EPUB content documents

Comments

@iherman
Copy link
Member

iherman commented Apr 6, 2021

§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
Copy link
Member Author

iherman commented Apr 6, 2021

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

@iherman iherman added Topic-ContentDocs The issue affects EPUB content documents Spec-ReadingSystems The issue affects the EPUB Reading Systems 3.3 Recommendation labels Apr 6, 2021
@dauwhe
Copy link
Contributor

dauwhe commented Apr 6, 2021

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
Copy link
Member Author

iherman commented Apr 6, 2021

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
Copy link
Contributor

dauwhe commented Apr 6, 2021

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
Copy link
Member

mattgarrish commented Apr 6, 2021

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
Copy link
Member Author

iherman commented Apr 6, 2021

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
Copy link
Member Author

iherman commented Apr 6, 2021

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
Copy link
Member Author

iherman commented Apr 7, 2021

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
Copy link
Member

rdeltour commented Apr 7, 2021

@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
Copy link
Member Author

iherman commented Apr 7, 2021

@rdeltour wow! I stand corrected...

@iherman
Copy link
Member Author

iherman commented Apr 9, 2021

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

List of resolutions:

  • Resolution No. 2: Amend the RS section to allow RSs to do whatever they "damn well" please with CSS direction
View the transcript

4. CSS Direction

See github issue #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
Copy link
Member Author

iherman commented Apr 17, 2021

Closing by virtue of #1627 having been merged.

@iherman iherman closed this as completed Apr 17, 2021
@OriIdan
Copy link

OriIdan commented Apr 20, 2021 via email

@mattgarrish mattgarrish added the EPUB33 Issues addressed in the EPUB 3.3 revision label May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EPUB33 Issues addressed in the EPUB 3.3 revision Spec-ReadingSystems The issue affects the EPUB Reading Systems 3.3 Recommendation Topic-ContentDocs The issue affects EPUB content documents
Projects
None yet
Development

No branches or pull requests

5 participants