Skip to content
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

refactor(config): enable stencil's experimental slot fixes #28995

Merged
merged 8 commits into from
Mar 12, 2024

Conversation

rwaskiewicz
Copy link
Member

@rwaskiewicz rwaskiewicz commented Feb 7, 2024

Issue number: N/A


What is the current behavior?

the stencil team has been working on fixing multiple issues with slots
elements in the stencil code base. to make these changes backwards
compatible and communicate that they were volatile, we added two
configuration flags for these fixes that were prefixed with the word
"experimental".

now that the effort to provide these fixes has largely solidified, the
features behind these flags are slightly less volatile. while the
"experimental" aspect still technically holds true, we've requested
the Framework team to enable these flags in a v8 beta. the stencil
team expects these flags to be set to true by default in stencil
v5, which ought to help prepare for future migrations the ionic
framework has to undergo.

Previously, Stencil would allow content to project through to a component even when a slot was not present. However, with the changes in extras.experimentalScopedSlotChanges, this behavior was changed to hide elements without a destination slot - matching the behavior of a shadow encapsulated component.

As such, elements projected through the ion-label or ion-buttons components would no longer be visible in rendered output.

What is the new behavior?

This commit adds an explicit slot tag to components in core leveraging "scoped" encapsulation with no rendered content (i.e. elements with only a Host tag and styles).

This fixes an issue with the ion-input component not re-rendering in some cases when using the label slot functionality.

HTML element patches in Stencil that are enabled by the experimentalSlotFixes flag result in DOM manipulations that won't trigger the current mutation observer configuration and callback.

Does this introduce a breaking change?

  • [] Yes
  • No

Other information

Would you like us to update the commit message to include the BREAKING CHANGE: comment? Unsure of the actual impact on end users here.

Similarly, would you like us to update the commit message here from chore() to something else?

@github-actions github-actions bot added the package: core @ionic/core package label Feb 7, 2024
@rwaskiewicz rwaskiewicz force-pushed the rwaskiewicz/enable-experimental-slot-fixes branch from 7f531e3 to 063e166 Compare February 8, 2024 20:47
@rwaskiewicz rwaskiewicz closed this Feb 8, 2024
@rwaskiewicz rwaskiewicz reopened this Feb 8, 2024
@rwaskiewicz rwaskiewicz force-pushed the rwaskiewicz/enable-experimental-slot-fixes branch from 063e166 to 68ae4a9 Compare February 8, 2024 21:25
@rwaskiewicz rwaskiewicz force-pushed the rwaskiewicz/enable-experimental-slot-fixes branch from ea211de to fd0fc3f Compare February 22, 2024 13:25
rwaskiewicz and others added 2 commits February 22, 2024 16:12
the stencil team has been working on fixing multiple issues with slots
elements in the stencil codebase. to make these changes backwards
compatible and communicate that they were volatile, we added two
configuration flags for these fixes that were prefixed with the word
"experimental".

now that the effort to provide these fixes has largely solidified, the
features behind these flags are slightly less volatile. while the
"experimental" aspect still technically holds true, we've requested
the Framework team to enable these flags in a v8 beta. the stencil
team expects these flags to be set to `true` by default in stencil
v5, which ought to help prepare for future migrations the ionic
framework has to undergo.
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Previously, Stencil would allow content to project through to a
component even when a slot was not present. However, with the changes in
`extras.experimentalScopedSlotChanges`, this behavior was changed to
hide elements without a destination slot - matching the behavior of a
shadow encapsulated component.

As such, elements projected through the `ion-label` or `ion-buttons`
components would no longer be visible in rendered output.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

This commit adds an explicit `slot` tag to components in core leveraging
"scoped" encapsulation with no rendered content (i.e. elements with only
a `Host` tag and styles).

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
@rwaskiewicz rwaskiewicz force-pushed the rwaskiewicz/enable-experimental-slot-fixes branch from fd0fc3f to 2a13799 Compare February 22, 2024 21:12
@rwaskiewicz rwaskiewicz marked this pull request as ready for review February 22, 2024 21:22
@rwaskiewicz rwaskiewicz requested a review from a team as a code owner February 22, 2024 21:22
@rwaskiewicz rwaskiewicz requested review from thetaPC and removed request for a team February 22, 2024 21:22
liamdebeasi and others added 3 commits March 1, 2024 10:08
This fixes an issue with the `ion-input` component not re-rendering in some cases when using the label slot functionality.

HTML element patches in Stencil that are enabled by the `experimentalSlotFixes` flag result in DOM manipulations that won't trigger the current mutation observer configuration and callback.
@thetaPC thetaPC changed the title chore(config): enable stencil's experimental slot fixes refactor(config): enable stencil's experimental slot fixes Mar 11, 2024
@@ -50,6 +50,7 @@ export const createSlotMutationController = (

hostMutationObserver.observe(el, {
childList: true,
subtree: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment explaining why this was adding. That way it's not accidentally removed in the future.

Comment on lines 261 to 262
experimentalSlotFixes: true,
experimentalScopedSlotChanges: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment noting that these are needed until a stable version is released.

@thetaPC
Copy link
Contributor

thetaPC commented Mar 11, 2024

This is not considered a breaking change so no additional work needs to be done for that.

@rwaskiewicz
Copy link
Member Author

@thetaPC Thanks! Added those comments in a85044a. I'll probably squash and amend the commit once this gets approved (before we merge it).

Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rwaskiewicz rwaskiewicz merged commit 5cf84ee into feature-8.0 Mar 12, 2024
44 checks passed
@rwaskiewicz rwaskiewicz deleted the rwaskiewicz/enable-experimental-slot-fixes branch March 12, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants