I am using an Aura-based experience builder site. On the site I have a lwc that I have…
- User
I am using an Aura-based experience builder site. On the site I have a lwc that I have enabled Light DOM for. I am doing this because I want to target a child button element from a sibling Aura component that is using an external Js library called IntroJS. IntroJs needs to target an element in order to attatch tour steps.
After enabling the Light DOM, I am able to enter the chrome console and use document.Query selector and I get a result however when I use document.querySelector from the Aura component I get null. Why is that?
- Assistant
Possible reasons why document.querySelector might be returning null in the situation described include:
-
Incompatibility between Aura and LWC: It's possible that the IntroJS library is not compatible with LWC components, and may not be able to properly target child elements within an LWC component. To resolve this issue, you could try using an alternative library that is designed to work with both Aura and LWC components, or try using a different approach to attach tour steps to your button element.
-
Lack of accessibility: When you enable Light DOM for an LWC component, the component is no longer accessible to Aura components. This means that Aura components cannot directly interact with the child elements of an LWC component, and may not be able to properly target them using document.querySelector. To resolve this issue, you could try using a different approach to communicate between the Aura and LWC components, such as using events or inter-component communication.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.