-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Custom HTML elements attach a Shadow DOM #933
Comments
Thanks for your report! My understanding is that most custom elements have shadow dom in them and I can only capture them with the shadow-dom way. I admit that I don't have much experience in custom elements. Could you also share an example using https://rrwebdebug.com/ ? |
|
I would like to check again whether the custom elements in your original web page contain shadow doms? |
Is this page using ShadyDOM polyfill? Check on page: If this is the case, because of the accuracy of the polyfill, In addition, the polyfill patches |
@lele0108 I followed your suggestion on this webpage https://www.partneradvantage.goog/GCPPRM/s/partnerselfregistration?language=en_US. Unfortunately, shadow dom on this site is poly filled but not by shadyDOM. |
Preflight Checklist
What package is this bug report for?
rrweb-snapshot
Expected Behavior
Looks like rrweb is processing incorrectly custom elements.
Custom elements are not a part of Shadow DOM, but during recording, all these elements receive the following options:
isShadow
andisShadowHost
. In some cases it may break replay.Actual Behavior
Recording
Custom elements receive
isShadow
andisShadowHost
options.Custom HTML element:
<community_navigation-global-navigation-trigger className="cAltToggleNav slds-icon_x-small" data-aura-rendered-by="367:0"> <lightning-button-icon></lightning-button-icon> <community_navigation-back-navigation-button></community_navigation-back-navigation-button> </community_navigation-global-navigation-trigger>
The same elements at snapshot:
{"type": 2, "tagName": "community_navigation-global-navigation-trigger", "attributes": { "class": "cAltToggleNav slds-icon_x-small", "data-aura-rendered-by": "367:0" }, "childNodes": [{ "type": 2, "tagName": "lightning-button-icon", "attributes": {}, "childNodes": [], "id": 167, "isShadowHost": true, "isShadow": true }, { "type": 2, "tagName": "community_navigation-back-navigation-button", "attributes": {}, "childNodes": [], "id": 175, "**isShadowHost**": true, "isShadow": true }], "id": 166, "isShadowHost": true }
Replay
On investigate how Replayer handle isShadowHost and isShadow options i came across a next comment in the code:
if (n.isShadowHost) { if (!node.shadowRoot) { node.attachShadow({ mode: 'open' }); } else { while (node.shadowRoot.firstChild) { node.shadowRoot.removeChild(node.shadowRoot.firstChild); } } }
Testcase Gist URL
No response
Additional Information
Replay where custom elements have isShadowHost and isShadow options:
Replay without those options:
The text was updated successfully, but these errors were encountered: