Stencil: Elements rendered outside of slot when shadow not enabled

Created on 17 Aug 2020  路  4Comments  路  Source: ionic-team/stencil

Stencil version:

 @stencil/[email protected]

I'm submitting a:
[ x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:
I am seeing the behavior described in #897. The only difference is I do not have shadow enabled. If I enable shadow I see the correct behavior.

Expected behavior:
Children added to a slot after initial render should show up inside the designated slot.

Steps to reproduce:

Related code:

Other information:

bug renderer

Most helpful comment

Thanks for the repo. I've confirmed that this occurs when:

  • Shadow DOM is _not_ used
  • An element is appended to a component with a <slot> via insertAdjacentHTML('beforeend', ...), el.appendChild(...), and also el.innerHTML += '...'

All 4 comments

Hi, the linked issue is pretty old and was closed out. If this is still affecting you, can you provide a test case so we can replicate it? Thanks!

I see this issue too :)
image
^ there's the effect.
https://github.com/johnjenkins/stencil-scoped-append-bug
^ there's a minimum repro

When the component gets re-rendered the newly added elements will be re-positioned.
So a workaround is to add a mutation observer on the component then force a re-render by changing an arbitrary state variable or something.

Thanks for the repo. I've confirmed that this occurs when:

  • Shadow DOM is _not_ used
  • An element is appended to a component with a <slot> via insertAdjacentHTML('beforeend', ...), el.appendChild(...), and also el.innerHTML += '...'

Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out.

Thank you for using Stencil!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MrMcGibblets picture MrMcGibblets  路  3Comments

ryanmunger picture ryanmunger  路  3Comments

joewoodhouse picture joewoodhouse  路  3Comments

MatanYadaev picture MatanYadaev  路  3Comments

guidoknoll picture guidoknoll  路  3Comments