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
In the documentation found here regarding the ion-input control it refers in the pattern property that the 'title' prop can be used to describe the pattern to the user so if the pattern does not match their input a custom message can be displayed. However currently when I set this value it doesn't seem to get passed down to the input element tag and remains on the ion-input tag:
<ion-input id="txt-username" value="" pattern="^[a-z0-9]*$" title="Usernames can contain only letters and numbers" placeholder="Username"> <input class="native-input sc-ion-input-ios" aria-labelledby="ion-input-1-lbl" autocapitalize="off" autocomplete="off" autocorrect="off" minlength="3" maxlength="20" name="ion-input-1" pattern="^[a-z0-9]*$" placeholder="Username" required="" spellcheck="false" type="text"> </ion-input>
Expected behavior:
The 'title' property should get moved down to the input element so that when a form is submitted with a value that doesn't match the pattern, the custom error message displays.
Related code:
<IonInput
value={username}
onIonChange={e => setUsername(e.detail.value!)}
required
pattern="^[a-z0-9]*$"
title="Usernames can contain only letters and numbers"
placeholder="Username">
</IonInput>
Thanks for the issue. This has been resolved via #22493, and a fix will be available in an upcoming release of Ionic Framework.
Since title is a global attribute we did not add this as a property. Instead, the attribute that you set on ion-input and ion-textarea is automatically passed to the inner input and textarea elements.
Additionally, this means that title will not show up in the documentation under "Properties" in the same way the global attributes such as id and class do not show up.
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.
Bug Report
Ionic version:
[ ] 4.x
[x] 5.x
Current behavior:
In the documentation found here regarding the ion-input control it refers in the pattern property that the 'title' prop can be used to describe the pattern to the user so if the pattern does not match their input a custom message can be displayed. However currently when I set this value it doesn't seem to get passed down to the input element tag and remains on the ion-input tag:
<ion-input id="txt-username" value="" pattern="^[a-z0-9]*$" title="Usernames can contain only letters and numbers" placeholder="Username"> <input class="native-input sc-ion-input-ios" aria-labelledby="ion-input-1-lbl" autocapitalize="off" autocomplete="off" autocorrect="off" minlength="3" maxlength="20" name="ion-input-1" pattern="^[a-z0-9]*$" placeholder="Username" required="" spellcheck="false" type="text"> </ion-input>
Expected behavior:
The 'title' property should get moved down to the input element so that when a form is submitted with a value that doesn't match the pattern, the custom error message displays.
Related code:
Other information:
Ionic info:
The text was updated successfully, but these errors were encountered: