Skip to content

Styling/scoping #47

Open
Open
@bkardell

Description

@bkardell

An issue came up in CSSWG about style scoping. It was linked to a kind of confused seeming thread but numerous people in CSSWG confirmed that they are consistently asked questions about this and don't really know what to say.

Here's the relevant IRC log with what I had to say: TL;DR: It's complicated, there's history and experimentation, CSSWG alone probably can't solve this problem, we need to involve developers by exposing the right things (several already underway or available), describing the history and problem and that solutions should be incubated.

Tab is going to work on putting together a history and maybe a post, probably some work in WICG.

If there are thoughts or disagreements, let me know.


astearns: And TabAtkins is still collecting data there.

12:19 PM A
w3c/csswg-drafts#270

12:19 PM D
Topic: [css-scoping] Support for CSS namespaces
12:20 PM ChrisL: This si the what to do with shadowDom thing. How do you style, do selectors work, etc. I think closing and saying we won't fix is doing the community a disservice. I'm hearing a lot of pain where people want to be able to do modularizable solutions. I see huge long naming conventions.

12:20 PM B<bkardell_> Brian Kardell
that issue seems confused

12:20 PM D
ChrisL: It's not do we have namespaces, it's what are we working toward to have local variable type styling for theme-ability. Just saying we won't do anything for a few years isn't appropriate.
12:21 PM TabAtkins: Today the answer is web components. THere are some holes and we'd like it something like easier to do declaritively, but we'd like it to mature to see where we need to go in. That's our focus. Everything that people suggest won't do what they want. You want hte full both directions that web components allow. Their solutions dont' think both directions. And browsers aren't doing scoped styles.
12:21 PM ChrisL: What does web componets allow? Can you theme and style? I'm not familiar enough

12:22 PM B<bkardell_> Brian Kardell
TabAtkins: it could be declarative today, right? all you need is a web component that just does that.

12:22 PM D
TabAtkins: If you put things in a shadow tree they're stylable in the tree. THe styles inside can't go out and the styles outside can't go in. So it's a full self-contained piece of HTML that won't be messed up by styling o nthe rest of the page.
12:22 PM leaverou: How are they themed?
12:22 PM leaverou: I've refraned from using components because they're not skin-able.

12:23 PM B<bkardell_> Brian Kardell
q+
12:23 PM Z— Zakim sees ChrisL, bkardell_ on the speaker queue

12:23 PM D
TabAtkins: We have some soultion now. If you use variables you can pass in styling one piece at a time. Not the most convient. We have the @apply rule that was generally accepted that lets you shift entire style blocks across the boundary.

12:23 PM C
q-
12:23 PM Z— Zakim sees bkardell_ on the speaker queue

12:24 PM D
TabAtkins: From inside the tree you can detect what's going on from the outside like if a class is on an ancestor so you can adjust accordingly. SO you can ship with multiple themes that do something depending on a class outside.

12:24 PM A
ack bkardell_
12:24 PM Z— Zakim sees no one on the speaker queue

12:24 PM I<iank_>
Polymer has a writeup here of the mixin/custom-prop solution: https://www.polymer-project.org/1.0/docs/devguide/styling#custom-css-properties

12:25 PM D
bkardell_: I wanted to add that one of the good things about this is that we did experiment with several things. Chrome and polymer had experiments to allow you to explicitly cross boundaries. We had a number of discussions based on what people thought they wanted, but when we gave it it wasn't really what they wanted.
12:25 PM bkardell_: Going forward we shoudl expose basic things, allow experimentation and progress. This is new ground. The only way we can know this is the right thing is to be allowed to use it.
12:26 PM TabAtkins: He's referring to the ::deep selector. It led to unending problems of people changing thigns they didn't mean to. So we diled back to explicit sharing. It's all the flexability without a footgun
12:27 PM leaverou: This sounds good but I'm skeptical that a component exposes its variable so to change it you have to change your CSS. Assuming there's no native slide, you want to use a slider and than another slider you have to look up the doc. Native components to accept some styling. It would be nice if author components did the same thing.
12:27 PM TabAtkins: That's good feedback. WE should keep that in mind as we move toward more declaritive.

12:27 PM B<bkardell_> Brian Kardell
but if we expose the right bits, then maybe people like leaverou can experiment with ways to do that in wicg :)

12:27 PM F
ChrisL w3c/csswg-drafts#270 (comment) ?

12:27 PM D
leaverou: I'm not sure this is jsut shadowDOM. I think it may also be nesting. That's another thing authors ask me about.
12:28 PM leaverou: Authors ask me a lot about nesting and scoping in every conference for the last few months. I don't know what to tell them.
12:28 PM leaverou: So nesting is another big thing. This is what the naming conventions are tryign to address.

12:28 PM F
www-style thread!!! :D

12:28 PM B<bkardell_> Brian Kardell
fantasai: nooooooooooooooo
12:28 PM :)
12:29 PM F— fantasai misses subthreading :(

12:29 PM D
astearns: So there's several issues. Scolping, nesting, a moredeclaritive approach to components. I'm not sure a single github thread will be that helpful. It might be good to have a single place with the history of this conversation. So look we have this deep selector and it didn't work like we wanted.
12:29 PM astearns: I'm thinking a wiki page with all the history where we can take this github and point it there to say we've worked on these things, we're trying these things. So we're not shutting down convo but it's not a sincle thread.

12:29 PM B<bkardell_> Brian Kardell
this really does sound to me like a great thing to bring up in wicg before csswg itself burns time on it... that is inclusive of devs and hopefully then we can bring back the good ideas

12:30 PM
astearns: I want a place where we can engage the community on these issues and some place with the history of what we tried and what we're looking to do.
12:30 PM ChrisL: SOunds great. So who sound write it and who has the material to begin it.
12:30 PM TabAtkins: I can start writing that. I have the history in my head.

12:30 PM B<bkardell_> Brian Kardell
q+
12:30 PM Z— Zakim sees bkardell_ on the speaker queue

12:30 PM D
fantasai: A blog post would be nice, but the commenting on our blog is too broken.

12:30 PM B<bkardell_> Brian Kardell
q-
12:30 PM Z— Zakim sees no one on the speaker queue

12:31 PM D
astearns: And bkardell_ mentioned on IRC that this may be good for the incubation group.

12:31 PM B<bkardell_> Brian Kardell
also repos and wikis and all available on wicg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions