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
{{ message }}
Repository navigation
feat: support clonable in the shadow option of @Component #6833
I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Stencil's createShadowRoot currently builds its options from mode, delegatesFocus and slotAssignment. There is no way for a component author to request clonable, and no way to reach the attachShadow call to set it.
The request is to expose it the same way delegatesFocus and slotAssignment already are.
Describe the Use Case
Any library that measures or duplicates DOM through cloneNode gets an empty element back when it reaches a Stencil shadow component, because the shadow root is silently dropped.
We hit this with AG Grid's column auto-sizing. To size a column to its contents, AG Grid deep clones the cell into an off screen container, reads offsetWidth, then discards the dummy clone. When a cell contains a Stencil shadow component the clone is an empty shell, so the measurement comes back at zero and the column collapses to the width of its header.
Describe Preferred Solution
Mirror the native option, exactly as the existing two options.
Add a clonable option to ShadowRootOptions.
Add a shadowClonable bit to CMP_FLAGS, set from the decorator at compile time.
Set it in createShadowRoot, behind a build flag like the existing BUILD.shadowDelegatesFocus.
I think I will roll this into the v5 release work as it fits much more naturally / easily into the new api shape (see "BREAKING CHANGE - @component API")
Thanks @johnjenkins! Makes sense to align this with the v5 API shape rather than bolt it onto the current one.
I went ahead and put together a working implementation in #6837 in case it's a useful starting point it follows the existing delegatesFocus / slotAssignment pipeline end to end (decorator → CMP_FLAGS → createShadowRoot → attachShadow), and also carries clonable through the mock-doc / declarative shadow DOM path so it survives SSR + hydrate, with tests at each layer.
Happy to reshape it to fit the new API in #6584 if you can point me at where clonable should live there or to leave it as-is for reference and let you roll it into the v5 work, whichever is more helpful. No worries either way.
Activity
johnjenkins commentedon Aug 18, 2026
👋 - thanks for raising and good idea.
I think I will roll this into the v5 release work as it fits much more naturally / easily into the new api shape (see "BREAKING CHANGE - @component API")
Arul1998 commentedon Aug 19, 2026
Thanks @johnjenkins! Makes sense to align this with the v5 API shape rather than bolt it onto the current one.
I went ahead and put together a working implementation in #6837 in case it's a useful starting point it follows the existing
delegatesFocus/slotAssignmentpipeline end to end (decorator →CMP_FLAGS→createShadowRoot→attachShadow), and also carriesclonablethrough the mock-doc / declarative shadow DOM path so it survives SSR + hydrate, with tests at each layer.Happy to reshape it to fit the new API in #6584 if you can point me at where
clonableshould live there or to leave it as-is for reference and let you roll it into the v5 work, whichever is more helpful. No worries either way.