-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
Currently, OC components are within the scope of the light DOM and do not provide any forms of style isolation out of the box. This potentially leaves the components to be altered by rogue global styles. Style isolation will be a nice feature to have so that we can ensure that the component will look the same regardless of where you use it. I would like to propose the inclusion of shadow DOM as part of the OC to prevent page styles from affecting the component and also prevent the component styles from leaking out.
I have played around with a POC and this is how it can be achieved:
- The means of toggling the shadow DOM feature can be handled via data-attributes (e.g. <oc-component …. data-enableShadow=true … /> ) of the OC element.
- We will need to update
oc-clint.jsinOC-CLIENT-BROWSERto handle the creation of shadow root in which the HTML markup can be set. This can be done in theprocessHTMLmethod. - Update the relevant templates to indicate that the target node is currently present in the shadow root rather than the light DOM.
I would like your feedback on this matter and am happy to make a PR once we agree on a solution.
Metadata
Metadata
Assignees
Labels
No labels