You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Web components are created with an open shadow root. I would like this to be configurable so that components can be created with a closed shadow root.
Describe the Use Case
My team works on a design system, and many feature teams access the Shadow DOM of our components to make adjustments (rather than reporting feature requests or bug reports). We frequently release typical minor/patch updates, which turn into breaking changes instead as they conflict with the adjustments made by the feature teams.
This is in a complex enterprise environment, where we are unable to enforce our best practices. Enabling closed shadow roots would help us release changes with more confidence.
Describe Preferred Solution
Extend ComponentOptions
The existing shadow property supports an object. The object should have the mode property that can set a shadow root to 'open' (default) or 'closed'. This configuration is my preferred solution as it's identical to the native Element.attachShadow() option.
With a closed shadow root, the @Element() decorator cannot be used to access its Shadow DOM, as the shadowRoot property is unavailable. So, perhaps a new decorator @ShadowRoot() can assign the shadow root reference. This decorator could also be used for open shadow roots, so it would not necessarily be a "closed shadow root"-only feature.
Alternatively, an additional property is introduced called shadowRoot that accepts the values 'open' (default) or 'closed'. This property would not do anything if shadow was set to false.
Another suggestion is an additional property called closedShadow that accepts the boolean true or false (default). This property would not do anything if shadow was set to false.
Thanks for the request! I'm going to get this labeled to gauge interest from the community. We'll keep tabs on this and post any updates here. Thanks again for the request!
Prerequisites
Describe the Feature Request
Web components are created with an open shadow root. I would like this to be configurable so that components can be created with a closed shadow root.
Describe the Use Case
My team works on a design system, and many feature teams access the Shadow DOM of our components to make adjustments (rather than reporting feature requests or bug reports). We frequently release typical minor/patch updates, which turn into breaking changes instead as they conflict with the adjustments made by the feature teams.
This is in a complex enterprise environment, where we are unable to enforce our best practices. Enabling closed shadow roots would help us release changes with more confidence.
Describe Preferred Solution
Extend ComponentOptions
The existing
shadow
property supports an object. The object should have themode
property that can set a shadow root to'open'
(default) or'closed'
. This configuration is my preferred solution as it's identical to the nativeElement.attachShadow()
option.New decorator to access shadow root
With a closed shadow root, the
@Element()
decorator cannot be used to access its Shadow DOM, as theshadowRoot
property is unavailable. So, perhaps a new decorator@ShadowRoot()
can assign the shadow root reference. This decorator could also be used for open shadow roots, so it would not necessarily be a "closed shadow root"-only feature.Describe Alternatives
Alternatively, an additional property is introduced called
shadowRoot
that accepts the values'open'
(default) or'closed'
. This property would not do anything ifshadow
was set tofalse
.Another suggestion is an additional property called
closedShadow
that accepts the booleantrue
orfalse
(default). This property would not do anything ifshadow
was set tofalse
.The text was updated successfully, but these errors were encountered: