You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: custom html label for input and textarea with modern form syntax #27061
but now with [email protected] the <ion-lable> component is discouraged and the [label] property of ion-input seems accepts strings only
so is there a workaround to get this done like before?
Describe Preferred Solution
No response
Describe Alternatives
No response
Related Code
No response
Additional Information
No response
Reacted by David Strauß, Marvin Heilemann, Daniel Sánchez and Emil Broll
Thanks for your response @liamdebeasi
I tried the code above and it works but there is a [Ionic Warning] in the console output and btw there is also a warning in the console even if I just keep the old style [email protected] codes
I also tried the code below to keep the html behaves like before and suppress the warning in the console which is just a not-so-beautiful workaround 😅
and it works without any [Ionic Warning] in the console
but I do not want to assign ids for my ion-label since there is a huge lot of fields in my html and it is a real difficulty to name ids for every fields 😅
Should issue be reopened? Bug https://bugs.webkit.org/show_bug.cgi?id=172567 for webkit already marked as resolved fixed if you were waiting for it. having id to use 'aria-labelledby' for each input (especially with arrays of forms) make development less pleasant than in ionic 6 and makes migration to 7 more risky.
In migration there is option to use legacy everywhere (but later will need to migrate anyway), use labelledby everywhere (no point in new style), use mix labelledby and new labels (need to fix css to make it visually match as paddings and text sizes are too different), use for now css ::after (and hope that no other functionality will be needed in future)
We've had a few people ask about this, so I am going to re-open for visibility. The linked WebKit has been resolved, but it's only applicable to iOS 16. We support back to iOS 14 so there are many iOS users who have not received the WebKit fix.
If you need complex HTML support we recommend associating an ion-label with ion-input using an aria-labelledby for now until we can introduce better support for HTML labels using the new input syntax.
changed the title [-]feat: inline html for label property with [email protected][/-][+]feat: custom html label for input and textarea with modern form syntax[/+]on Apr 21, 2023
We will be adding experimental support to both ion-input and ion-textarea for custom HTML labels with the modern form syntax. This feature will be available in the next minor release of Ionic, and we will have updated documentation to show how to use it.
The work required to add this functionality has been completed, so I am going to close this. Thanks!
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.
Activity
[-]feat: inline html for label property[/-][+]feat: inline html for label property with [email protected][/+]liamdebeasi commentedon Mar 30, 2023
Thanks for the report. This feature requires that
ion-inputandion-textareause the Shadow DOM which breaks autofill on iOS 14-16: https://bugs.webkit.org/show_bug.cgi?id=172567 (This feature was recently fixed, but it has not been released yet). As a result, we are unable to add the requested feature at this time.However, you can continue using
ion-labelwitharia-labelledby:Can you give this a try, and let me know if it works?
emeryao commentedon Mar 31, 2023
Thanks for your response @liamdebeasi
I tried the code above and it works but there is a
[Ionic Warning]in the console output and btw there is also a warning in the console even if I just keep the old style [email protected] codesI also tried the code below to keep the html behaves like before and suppress the warning in the console which is just a not-so-beautiful workaround 😅
liamdebeasi commentedon Apr 3, 2023
Are you using
aria-labelledbywith no Angular binding? (i.e. not using[ariaLabelledBy]).Here is an example that uses
aria-labelldbywithout a warning: https://codepen.io/liamdebeasi/pen/PodMEBBemeryao commentedon Apr 6, 2023
Thanks for your advise and I have done another test with the latest
@ionic/[email protected]with the code belowand it works without any [Ionic Warning] in the console
but I do not want to assign
ids for myion-labelsince there is a huge lot of fields in my html and it is a real difficulty to name ids for every fields 😅Sorry for the late reply
4 remaining items
liamdebeasi commentedon Apr 19, 2023
Definitely not ideal, but you can do something like this:
znotdead commentedon Apr 19, 2023
Should issue be reopened? Bug https://bugs.webkit.org/show_bug.cgi?id=172567 for webkit already marked as resolved fixed if you were waiting for it. having id to use 'aria-labelledby' for each input (especially with arrays of forms) make development less pleasant than in ionic 6 and makes migration to 7 more risky.
In migration there is option to use legacy everywhere (but later will need to migrate anyway), use labelledby everywhere (no point in new style), use mix labelledby and new labels (need to fix css to make it visually match as paddings and text sizes are too different), use for now css ::after (and hope that no other functionality will be needed in future)
liamdebeasi commentedon Apr 21, 2023
We've had a few people ask about this, so I am going to re-open for visibility. The linked WebKit has been resolved, but it's only applicable to iOS 16. We support back to iOS 14 so there are many iOS users who have not received the WebKit fix.
If you need complex HTML support we recommend associating an
ion-labelwithion-inputusing anaria-labelledbyfor now until we can introduce better support for HTML labels using the new input syntax.[-]feat: inline html for label property with [email protected][/-][+]feat: custom html label for input and textarea with modern form syntax[/+]feat(input): add experimental label slot (#27650)
feat(textarea): add experimental label slot (#27677)
liamdebeasi commentedon Jun 20, 2023
Hi everyone,
We will be adding experimental support to both
ion-inputandion-textareafor custom HTML labels with the modern form syntax. This feature will be available in the next minor release of Ionic, and we will have updated documentation to show how to use it.The work required to add this functionality has been completed, so I am going to close this. Thanks!
ionitron-bot commentedon Jul 20, 2023
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.