- From: Joe Pea <notifications@github.com>
- Date: Sun, 18 May 2025 00:22:44 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/909/2888825057@github.com>
trusktr left a comment (WICG/webcomponents#909) > This makes the feature more powerful because you can pass styles in a controlled way down from other components creating a scoped patent for example with general theme styles and leave it's presentational children open to inheritance. @castastrophe This works until we *need* to change styling of content in some 3rd-party element, and that element has not specified for its styling to be open. Not only is it not ergnomoic to have to then reach into `shadowRoot` or patch `attachShadow`, but it also requires JavaScript. --- I think `<style global>` is a really good option. Devs would learn good practices: - use regular style and try to keep styles encapsulated as a default good practice. - use global styles only for scenarios like app-wide themes or app-wide overrides, or as an escape hatch when some deep content needs to be styled (especially with 3rd-party elements where otherwise a bunch of ugly JS code would be needed). **There's no perfect solution to this, which I think is what we have to accept here.** But one thing is for sure: web styling was flexible in a simple way in the earlier days, and now ShadowDOM currently eliminates that flexibility which is not always a good thing. --- Another possibility is that an open-stylable opt in (as in, opt in from the outside by end users of elements, not opt in by CE authors, f.e. with `<style global>`) would make it _incredibly easy_ to port a ton of libraries from the ecosystems of React/Vue/Svelte/Angular/Solid.js etc, and would also make it incredibly easy for people using CSS libraries with React/Vue/Svelte/Angular/Solid/etc to migrate to custom elements in a very minimal way, which might be a boon for custom elements adoption. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/909#issuecomment-2888825057 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/909/2888825057@github.com>
Received on Sunday, 18 May 2025 07:22:48 UTC