#Development #Pitfalls
All browsers get this wrong · What DevTools misinterpret about Shadow DOM https://ilo.im/163dax
_____
#Bugs #Specification #WebComponents #ShadowDOM #DevTools #Browser #WebDev #Frontend #DOM #CSS
#Development #Pitfalls
All browsers get this wrong · What DevTools misinterpret about Shadow DOM https://ilo.im/163dax
_____
#Bugs #Specification #WebComponents #ShadowDOM #DevTools #Browser #WebDev #Frontend #DOM #CSS
I'm in total agreement with this post: https://gomakethings.com/the-shadow-dom-is-an-antipattern/ - the ability to have a global CSS system is something that has been encouraged for YEARS as a matter of reducing the download footprint, yet shadow dom discourages this.
And there shouldn't be any technical reason why slots should require shadow. take this declared child, move it to that spot in my html structure. It can be (and has been) faked by multiple frameworks including lit, stencil, and JET.
'generic' web components that use internal CSS to define the layout, and then rely on a global css system to be flexible in appearance, is what we web-devs really want.
TIL: The @font-face rule does not work in the shadow DOM
https://fbedussi.github.io/blog/til/The-font-face-rule-does-not-work-in-the-shadow-DOM
New Kitten release
• Now leaves <style> tags within <template> tags alone when collating and normalising the CSS on a page so as not to interfere with scoped styles in declarative shadow DOM.
(Kitten’s Streaming HTML workflow¹ – which uses htmx and WebSockets under the hood – combined with built-in support for slots, etc., in Kitten components² means the use of declarative shadow DOM is mostly useful if you want scoped styles. Ideally, of course, use classes to scope styles to your components and be specific in your CSS selectors in general so as not to pollute elements in your components. Although that’s a bit like saying you should floss everyday. Yeah, we all know we should…) :)
Update: All that said, I’d highly recommend you don’t use Shadow DOM in your Kitten apps. For one thing, htmx’s WebSocket extension doesn’t seem to play well with it. And for another, you really don’t need it and definitely not just to get scoped CSS.
Enjoy!
¹ https://kitten.small-web.org/tutorials/streaming-html/
² https://kitten.small-web.org/tutorials/components-and-fragments/
Wtf is #ShadowDOM and can it please go away?
In that it was dropped as part of a thread that you might have otherwise been uninterested in, sharing this again to start your Thursday:
https://blog.westbrookjohnson.com/patterns/i-am-feeling-so-disconnected/
Catch up on some techniques for managing connection time work in a custom element. There's even reasons for using shadow DOM hidden in there.
Thanks @nachtfunke for starting the convo on this and @zachleat for challenging a toot into a full on blog dump.
@zachleat @nachtfunke I'm not saying this is because I didn't get you anything for your birthday, but I'm also not saying it isn't because of that...
https://blog.westbrookjohnson.com/patterns/i-am-feeling-so-disconnected/
This is a re-post since I don't see Keith on here:
Call to action for #WebComponent / #ShadowDOM fans: I've added an experimental flag to Firefox lifting the restriction on adoptedStyleSheets, meaning shadowroots can adopt `link.sheet` or `style.sheet`.
Please try this out, and let me know if you encounter issues!
https://github.com/w3c/csswg-drafts/issues/10013
https://github.com/w3c/csswg-drafts/issues/10013#issuecomment-2627222385
Call to action for #WebComponent / #ShadowDOM fans: I've added an experimental flag to Firefox lifting the restriction on adoptedStyleSheets, meaning shadowroots can adopt `link.sheet` or `style.sheet`.
Please try this out, and let me know if you encounter issues!
#Development #Explorations
Isomorphic web components · Who says web components can’t be rendered server-side? https://ilo.im/161cdx
_____
#WebComponents #WebPlatform #WebDev #Frontend #LightDOM #ShadowDOM #HTML #JavaScript #Backend #Server
#Development #Techniques
Combining light DOM and shadow DOM · How to mix-and-match both in a web component https://ilo.im/160yn2
_____
#WebComponents #LightDom #ShadowDom #Frontend #HTML #CSS #JavaScript
_Is_ this interesting? Not sure. It's been fun for a couple of recent #customElements that wrap native elements, but whether it's actually a good pattern or not...we can only clarify together!
Style Passthrough Elements? https://blog.westbrookjohnson.com/patterns/style-passthrough/
I think #CSS vars are good enough for bridging styles from a page into it's #webComponents' #shadowDOM
@Seetee Learning is a particularly personal process, so one API at a time or all at once depends more on you. On the whole, knowing how to leverage each of the #webComponent APIs individually is very important to your overall success in deciding the right solution for any problem.
That said, a lot of my problems ARE solved by focusing my DOM tree for both functionality AND styles via #shadowDOM; easier to reason and share.
What sort of problems are you looking to solve with web components?
I’ve never had stress around putting all my #CSS for all of my #webComponent in their #shadowDOM… ask me anything.
@knowler MDN accepts PRs…
I started working on https://github.com/Westbrook/axe-core-element-internals as a test bed for #ElementInternals usage for ace-core, but maybe more useful at large for these APIs. I accept PRs, too.
Also, we’re looking to reignite the push for community docs and guides for WCs in https://discord.gg/KzgaSbGc9q to clarify these sorts of things, as well.
#Development #Experiences
Where web components shine · Beware: “Not everything needs to be a web component.“ https://ilo.im/160iba
_____
#WebComponents #Accessibility #SSR #ShadowDOM #ProgressiveEnhancement #WebDev #Frontend #HTML #JavaScript
@oldcoyote Hopefully, yes!
There's still some back and forth in the TAG design review to work through: https://github.com/w3ctag/design-reviews/issues/961 But, after 3+ years of my active involvement, and 10+ years of various incredibly smart people attempting at this since the very inception of #webComponents and #shadowDOM, the air is tingling with anticipation.
@brucelawson and, it’s behind the Experimental Web Platform Features flag in Chromium, so you can try it out today!!