#Issue with astro injecting html tags

1 messages · Page 1 of 1 (latest)

balmy meadow
#

We're using styles like .section + .section, but when we implement a React component, Astro injects its own elements above. So we'd lose some selectors...

#

Any ideas? 😄

sacred basin
#

If it's a React component with a client directive it will always be enclosed with an astro-island tag.

#

That's not avoidable

balmy meadow
#

Yeah but it's not enclosed. There's just a <style> tag and a <script> tag injected above.

sacred basin
#

Are you using a client directive on your react components??

balmy meadow
#

Sorry, yes there is a client:load attribute added

#

But I'd expect the added tags to be enclosed in this <astro-island> tag.

#

Because of that client:load it's injecting the <style> and <script> tag (see the image attached to this support post) above even this <Section modifiers="overflow-hidden">

#

It goes all the way "up the chain" to the parent component and then adds those tags. Maybe that's working as intended of course, but just checking if there's a way to circumvent this or if we're just going to have to adjust our css selectors 🙂