w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.48k stars 660 forks source link

Separation of style and content #3778

Closed annevk closed 3 months ago

annevk commented 5 years ago

Forgive this somewhat philosophical question. I'm a little curious at where we draw the line these days.

Given that various non-visual features in browsers nevertheless use the result of layout (e.g., AT, find-in-page in some implementations, focus), can we still argue that separation of style and content exists? (Or have we already given up on that?)

What stops us from going even further, e.g., annotating elements with ARIA roles and properties through CSS?

Crissov commented 5 years ago

Circular dependency perhaps?

[foo=bar] {attribute: "foo" "quuz";} 

That is not to say that it would be a bad idea to reuse Selectors and perhaps CSS Syntax for an attribute association language.

bkardell commented 5 years ago

? If you unset the UI sheet you might 'technically' get content but it would be 99% unusuable to actual humans I think.

To @annevk's original post I kind of wonder about it a little more nuanced that I read his question - so while I am not sure how starkly he means it I am myself very curious in asking "perhaps we have over-stressed some things and would it be helpful (I think yes) for the WG to examine and articulate a more finessed philosophy here that accounts for a lot of history, practice and reality since that allow us to resolve a lot of things and give us good practical paths forward"?

tabatkins commented 5 years ago

Yeah, Cascading Attribute Sheets, a simple scripting language that uses CSS syntax to apply attributes to elements on the page. I seriously proposed it back in 2012, but it didn't go anywhere.

alice commented 5 years ago

I think it's a false dichotomy in any case to assume that the accessibility tree, focus, find in page etc. shouldn't depend on style. These experiences are and should be fundamentally based on the end result of layout, rendering etc, not the un-styled markup. It would make no sense for an element with display: none to take focus, for example.

For what my opinion is worth here, I think of the separation of style and content as more of a pragmatic progressive enhancement issue than a strict separation issue. Things should work ok without style, and probably better with style; they're unlikely to be the same experience, but they should be comparable (which is a useful term from the inclusive design sphere).

To me that helps draw a line around what information belongs in style and what doesn't - does this belong to the baseline experience or the styled experience? I could conceive of a case where a role only makes sense in the context of a style, and the page works OK without it (for example, applying a non-widget ARIA role to a pseudo-element).

bkardell commented 5 years ago

Many, many things in #3775 seem related to me. Sites, even specs I think, use generated content for things that if you don't announce or when they don't appear in copy/paste operations seem problematic in actual practice now that we have had time to live with them.

svgeesus commented 3 months ago

@annevk do these responses answer your question, and if not is there a concrete change you want to see (in CSS specs, or in TAG design principles)?

annevk commented 3 months ago

I'm happy to close this. I think as the responses indicate the line has always be somewhat blurry, but overall the separation is useful.