-
Notifications
You must be signed in to change notification settings - Fork 798
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: slot element loses its parent reference and disappears when its parent is rendered conditionally #3913
Comments
just tested - this bug will be fixed by this pr |
thanks for your quick response! However, do you expect that this PR is gonna be merged soon? I see it is open since June 2021 😞 Do you think I can do anything to speed up this process? |
Hey all, We're going to be working on slot-related fixes following the Stencil v3 release, which is slated to occur in January. Thanks! |
Potentially related #4284 |
…hanges (#5120) * fix(runtime): re-relocate slot if parent element's tagname changes If a slot is located in an element and that element's tag is dynamically changed (e.g. from `p` to `span`), we need to re-relocate the slot on re-render STENCIL-672: slot element loses its parent reference and disappears when its parent is rendered conditionally Fixes: #4284, #3913 * add e2e tests * code documentation * put changes behind slot fix flag * resolve new SNC * Apply suggestions from code review Co-authored-by: Ryan Waskiewicz <ryanwaskiewicz@gmail.com> --------- Co-authored-by: Ryan Waskiewicz <ryanwaskiewicz@gmail.com>
…onents (#5135) * fix(runtime): re-relocate slot if parent element's tagname changes If a slot is located in an element and that element's tag is dynamically changed (e.g. from `p` to `span`), we need to re-relocate the slot on re-render STENCIL-672: slot element loses its parent reference and disappears when its parent is rendered conditionally Fixes: #4284, #3913 * add e2e tests * code documentation * put changes behind slot fix flag * resolve new SNC * reset `hidden` state of nodes on relocate It is possible for slotted content to still be invisible in the DOM if the slot was not rendered on the first render. This commit resets the `hidden` attribute of a node on successful relocation. STENCIL-1053 * hide slot content without a home in `scoped` components Hides any content that is projected through to a Stencil component that does not have a destination slot. Only for `scoped` components. Fixes #2877 STENCIL-938 * add e2e tests for hiding content without a slot * revert karma config * PR feedback Co-authored-by: Christian Bromann <git@bromann.dev> --------- Co-authored-by: Christian Bromann <git@bromann.dev>
Hey there 👋 we have released a Stencil version |
Prerequisites
Stencil Version
2.13.0
Current Behavior
When I try to render the default slot within the conditionally rendered parent element in the no-shadow component and the parent element is changed, the slot relocation algorithm loses the parent element reference and the slot element is not relocated (re-rendered) into the new parent element.
Expected Behavior
Slot element should be relocated to the new parent element.
System Info
No response
Steps to Reproduce
In the reproduction project:
Code Reproduction URL
https://github.com/yigityuce/stencil-conditional-rendering-issue/commits/master
Additional Information
The issue might be here in the renderer (the old and new node tags checking)
https://github.com/ionic-team/stencil/blob/main/src/runtime/vdom/vdom-render.ts#L153
The goal is to follow the accessibility rules and the sementic web. I want to render the hX tags (h1, h2, ..., h6) correctly regarding the typography as Material UI does. (https://mui.com/material-ui/react-typography/#changing-the-semantic-element)
And the inspiration comes from the ionic-button component: https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/button/button.tsx#L302
The text was updated successfully, but these errors were encountered: