Repository navigation
Closed
Labels
package: angular@ionic/angular packagepackage: core@ionic/core packagetype: buga confirmed bug report
Description
Bug Report
Ionic version:
[x] 4.x
Current behavior:
When a default value is present for an ion-textarea, the ion-label does not float properly. Ion-item css styles shows the css class item-input instead of item-has-value. This behavior is observed using latest beta.16 of ionic/angular

The behavior corrects when focus has been applied to the ion-textarea.

Expected behavior:
When an ion-textarea has a value, the label should float properly.
Steps to reproduce:
Related code:
<ion-list inset>
<ion-item no-padding>
<ion-label position="floating">Status</ion-label>
<ion-select formControlName="status">
<ion-select-option value="New">New</ion-select-option>
<ion-select-option value="Processing">Processing</ion-select-option>
<ion-select-option value="Accepted">Accepted</ion-select-option>
<ion-select-option value="Rejected">Rejected</ion-select-option>
<ion-select-option value="Cancelled">Cancelled</ion-select-option>
</ion-select>
</ion-item>
<ion-item no-padding>
<ion-label position="floating">Incident Date</ion-label>
<ion-datetime formControlName="incidentDate" displayFormat="DD MMM YYYY"></ion-datetime>
</ion-item>
<ion-item no-padding>
<ion-label position="floating">Description</ion-label>
<ion-textarea formControlName="description" type="text" rows="5" required="true"></ion-textarea>
</ion-item>
</ion-list>
Other information:
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.4.0
Ionic Framework : @ionic/angular 4.0.0-beta.16
@angular-devkit/build-angular : 0.12.3
@angular-devkit/schematics : 7.0.7
@angular/cli : 7.0.7
@ionic/angular-toolkit : 1.2.0
System:
NodeJS : v8.12.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
Reacted by Matthew Valenti
Metadata
Metadata
Assignees
Labels
package: angular@ionic/angular packagepackage: core@ionic/core packagetype: buga confirmed bug report
Type
Fields
No fields configured for issues without a type.
Activity
akki-jat commentedon Mar 2, 2019
Hi @rianne-pagtalunan, facing the same problem. Got any solution?
rianne-pagtalunan commentedon Mar 4, 2019
hi @akki-jat, still nothing. I've switched to using fixed/stacked labels when text-area has a value as a temporary workaround.
akki-jat commentedon Mar 7, 2019
@rianne-pagtalunan I am using a hack. Just disable then set value and enable the textarea JS/TS code.
MaxiAringoli commentedon Mar 27, 2019
Same problem
brandyscarney commentedon Apr 11, 2019
Thanks for the issue! I believe this is related to Angular forms. Could you test to see if it works setting the value with
ngModel?mburger81 commentedon Apr 12, 2019
We did this
And this is the result:

As you can see if using angular or ngmodel binding which is async the floating label is not working. All the other use cases are working
brandyscarney commentedon Apr 12, 2019
Thanks so much @mburger81! That helps a lot. I confirmed that this happens to textarea with a setTimeout on it in core, without Angular. It does not happen to the
ion-input. Here's a Codepen reproducing it: https://codepen.io/brandyscarney/pen/XQgwJMI'll add it to the project. I think the problem is as simple as
this.emitStyle()not being called on value change:I'll take a quick look at this.
fix(textarea): float label when a value is changed async
brandyscarney commentedon Apr 12, 2019
That was definitely the problem, submitted a pull request with the fix: #18024
fix(textarea): float label when a value is changed async (#18024)
mburger81 commentedon Apr 18, 2019
version 4.3.0 definitely resolves the issue for us
ionitron-bot commentedon May 18, 2019
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.