-
Notifications
You must be signed in to change notification settings - Fork 13.5k
bug: Angular ion-item combined with stacked ion-label loses item-label-stacked class once ion-chip is added #24312
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
Comments
@astukanov thanks for the bug report and reproduction app! The issue here is the use of multiple With the usage of <ion-item>
<ion-label position="stacked">Label</ion-label>
<ion-chip *ngFor="let value of control.value">
<ion-label>{{value}}</ion-label>
</ion-chip>
</ion-item> To fix your problem, update the <ion-chip *ngFor="let value of control.value">
<span>{{value}}</span>
</ion-chip> Can you let me know if this solves the problem on your end? |
Thanks a lot for your reply and support. Yes, avoiding the use of ion-label inside chips works like a charm. Would it maybe make sense to change the examples at https://ionicframework.com/docs/api/chip to avoid such incidents? P.S. for those who are interested if adding the stacked property to ion-label inside the chips will sove the issue, here is what happens: Code:
|
@astukanov Really good question regarding the documentation. I'll consult with the team and discuss best options for this issue. There's related issues around The relationship of how the inner I've started to explore this issue privately and there's a few paths that have presented themselves (although I am open to suggestions):
<ion-item>
<ion-label position="stacked">Email</ion-label>
<ion-input></ion-input>
<ion-label>Because this is last it will not affect ion-item.</ion-label>
</ion-item>
<ion-item>
<ion-label position="stacked" main="true">Email</ion-label>
<ion-input></ion-input>
<ion-label>Your email must contain a .com</ion-label>
</ion-item>
<ion-stacked-item label="Plain text">
<ion-input></ion-input>
</ion-stacked-item>
<ion-stacked-item color="secondary">
<div slot="label">
Slot usage of label
</div>
<ion-input></ion-input>
</ion-stacked-item>
<ion-item labelId="emailLbl">
<ion-label id="emailLbl" position="stacked">Email</ion-label>
<ion-input></ion-input>
</ion-item> Option 3 is currently the only path that resolves the inner contents, automatically re-rendering the |
Hi @sean-perkins To be honest I'm very new to Ionic and havent had the possibility yet to deep-dive into the framework. From my experience option 3, alongside the mentioned disadvantages, would add further complexity to the framework. It would be great to avoid this if possible. The proposals (2 and 4), are so far my favorites. they allow to keep the current implemetation as is and provide additional functionality while also being robust. To achieve this without blocking the id attribute or to prevent multiple DOM child check iterations, an Example: <ion-item [label]="label">
<ion-label #label position="stacked">Email</ion-label>
<ion-input></ion-input>
</ion-item> Another solution could be to extract a base component from |
Hi there, We are proposing some changes to form components that seek to resolve this issue. We would love your feedback on these proposed changes! You can read more about the changes and leave comments here: #25661 |
Thanks for the report. In Ionic 7 we are introducing a new syntax for working with ion-input. This issue is fixed when using that new syntax. We will have an Ionic 7 beta in the future where developers can test and provide feedback. There will also be a migration guide to show how to update to the new input syntax. The work required to resolve this has been completed, so I am going to close this thread. Let me know if there are any questions. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
Current Behavior
ion-item combined with stacked ion-label loses item-label-stacked class once ion-chip is added inside ion-item.
Expected Behavior
ion-item stays in stacked mode after ion-chip is added
Steps to Reproduce
Code Reproduction URL
https://github.com/astukanov/ion-label-stacked-with-chip-bug
Ionic Info
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: