Re: [csswg-drafts] [css-cascade-6] Strong vs weak scoping proximity (#6790)

Yeah, the problem with examples https://github.com/w3c/csswg-drafts/issues/6790#issuecomment-1448456751 like and https://github.com/w3c/csswg-drafts/issues/8500#issuecomment-1448243790 is that they rely on an assumption that we know (in the abstract) what the author intended. As @bramus points out in [his follow-up comment](https://github.com/w3c/csswg-drafts/issues/8500#issuecomment-1448262110):

> Second guessing myself: depends on how you look at the “problem”. Is the goal of the author to color the links in the header similarly, or is the goal to be able to drop a nav element/component just anywhere in the DOM and have it look the same? 🤔

In the mis-matched lower boundaries example, the intent is clear to a human eye - but not at all clear as a general rule. 'Strong' scope proximity may help solve the relation between those two light/dark scopes specifically, but there might be third or fourth scopes in play: such as components on the page. Are we certain that the 'closer' of `@scope (nav)` and `@scope (.theme-light)` should always win, regardless of specificity?

We just can't solve these problems for authors in the abstract, and we shouldn't try to. Which one should 'win' is often situational, and authors will need to manage those situations intentionally. We can't magically 'get it right' in every single situation, including authoring-mistakes. All we can do is provide the tools for authors to resolve those questions when they come up. We should think of specificity, proximity, and layers as tools that authors can use to balance the cascade as they need.

From that perspective:

1. The argument for 'weak' scope proximity is that:
  - Authors already have explicit tools for managing specificity, while proximity is entirely determined by the DOM
  - The tool that authors have more control over is the tool that should take priority

2. The counter for 'strong' scope would be:
  - Now that we have layers, which provide a more explicit author layering from the CSS…
  - Placing scope between layers and specificity, authors have CSS layering controls on both sides of proximity

What has leaned me towards option 1 is that authors are already very familiar with managing specificity - but I do think either could work. I just don't want to sit on the decision indefinitely. I don't believe we're going to get a lot more author input on a prototype than we have already.

-- 
GitHub Notification of comment by mirisuzanne
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6790#issuecomment-1448692701 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 28 February 2023 18:51:44 UTC