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

feat(calcite-stepper): allow calcite-stepper to receive slotted items from wrapper component #11522

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

kstinson14
Copy link
Contributor

Related Issue: #

Summary

In Field Maps, we use the calcite-stepper in several places, many times with accompanying forward/backward buttons. So we've bundled them together in a wrapper web-component with a slot allowing each usage to pass in its desired calcite-stepper-items. So it looks something like this:

<wrapper-component>
  <calcite-stepper numbered layout="horizontal">
    <slot/>
  </calcite-stepper>
  ...[code for buttons, etc.]
</wrapper-component>

However, this usage passes the calcite-stepper-items within the calcite-stepper's slot, but does not pass its props to them (numbered, layout, etc.) causing them to render incorrectly. I believe this is because the function that performs this task, updateItems finds the items through this.el.querySelector. This doesn't work in the wrapping component scenario due to them being wrapped in a slot. I have a branch here that repros the problem on the local demo site with a dummy stepper-wrapper component.

I've fixed this by keeping track of the slot element after the slot change event and using its assigned calcite-stepper-items in updateItems instead. I also call updateItems in the slot change event. This seems to work for wrapped / unwrapped steppers.

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

@github-actions github-actions bot added the Stale Issues or pull requests that have not had recent activity. label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Issues or pull requests that have not had recent activity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant