Skip to content

Elements rendered outside of slot when shadow not enabled #2641

Closed

Description

@Jbcampbe

Stencil version:

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:

Activity

  1. added
    Awaiting Reply
    and removed on Nov 18, 2020
  2. claviska commented on Nov 18, 2020

    @claviska
    Contributor

    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!

  3. johnjenkins commented on Nov 26, 2020

    @johnjenkins
    Contributor

    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.

  4. added and removed
    Awaiting Reply
    on Nov 30, 2020
  5. claviska commented on Nov 30, 2020

    @claviska
    Contributor

    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 += '...'
  6. added
    ionitron: stale issue
    on Dec 30, 2020
  7. ionitron-bot commented on Dec 30, 2020

    @ionitron-bot

    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!

  8. locked and limited conversation to collaborators on Dec 30, 2020
  9. removed
    ionitron: stale issue
    on Dec 30, 2020
  10. added
    ionitron: stale issue
    on Jan 29, 2021
  11. added
    Resolution: Needs Investigation
    and removed
    ionitron: stale issue
    on Mar 25, 2022
  12. added
    Bug: Validated
    and removed
    Resolution: Needs Investigation
    on Jul 24, 2023
  13. rwaskiewicz commented on Sep 5, 2023

    @rwaskiewicz
    Member

    The fix for this issue has been released as a part of today's v4.2.0 release. To enable it, please ensure that experimantalSlotFixes (Docs) is set to true in your stencil.config.ts file. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: Validatedslot-related

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions