Re: [WICG/webcomponents] Web components should be able to easily adapt to the host page while maintaining enapsulation (Issue #986)

@LeaVerou Categorization is a natural thing to do when breaking down a large problem space with many different solutions. If you think I've miscategorized the type of components you are talking about, then what category do you think they belong to?

From your example, `<img-input>` only works after its JavaScript has run. That means it can be used in certain contexts, a client-side rendered app that expects JavaScript to run for the page to be functional. But for many other types of sites where JavaScript is not a requirement, but a progressive enhancement, using `<img-input>` means that you are potentially sacrificing functionality (the ability to upload an image) if for some reason the JavaScript does not load (if the CDN is down, for example).

>  Is the idea that <fancy-input> should only ever use form elements provided by the user in the light DOM, and authors should simply not use form elements in the shadow DOM? What is the shadow DOM for in this view? Just divs and spans around light DOM content?

The idea is that all **important** elements should be in the light DOM. That is, something you would consider a requirement for a functional page. If `<fancy-input>` is doing something you deem to be unimportant, and purely additive, then it would be ok to put it in the shadow DOM.

So, as an example, a submit button for a user to buy your product is very important, it should always be in the light DOM or you are risking a chance of not receiving payment. What is less important is up to the individual site. I tend to think everything is important, otherwise why is it on my site in the first place.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/986#issuecomment-1472138000
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/986/1472138000@github.com>

Received on Thursday, 16 March 2023 14:56:48 UTC