question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ion-label floating not working properly it disappears

See original GitHub issue

Bug Report

Ionic version:

[x] 4.4.0

Current behavior:

Label with position float disappears when get focused to ion-input

Expected behavior:

should not disappear as previous versions

Steps to reproduce:

  1. Create a project using ionic v4.4.0

  2. Create an ion-item with

<ion-item>
      <ion-label position="floating">
        <div class="lstn-subtitle1">
          {{ 'LBL_FULL_NAME' | translate}}
        </div>
      </ion-label>
      <ion-input clearInput formControlName="fullname">
      </ion-input>
</ion-item>

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (C:\Users\sheri\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.3.6
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.4.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : android 8.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 11 other plugins)

System:

   NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
SherifMoShalabycommented, May 14, 2019

yes you are right thanks for help

1reaction
brandyscarneycommented, May 13, 2019

Thanks for the response! So it looks like you are overriding the --ion-color-primary value somewhere to be #ffffff or white. The label was updated to use the primary color on focus to match the Material Design spec. You may want to search your project for --ion-color-primary to see where you are overriding this color. The primary color is used as an accent color throughout several Ionic components and I wouldn’t recommend overriding it to white as it will make a lot of defaults look off. Here is where we set them in our Angular starters: https://github.com/ionic-team/ionic-conference-app/blob/master/src/theme/variables.scss#L23

You can see changing the primary color to white here immediately makes segment look like it is missing a button: https://ionicframework.com/docs/theming/color-generator

Here’s a way to change just the label color on item focus:

.item-has-focus ion-label {
  color: purple !important;
}

The reason for !important is this issue: https://github.com/ionic-team/ionic/issues/17425

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: ion-label floating not working properly it disappears ...
Bug Report. Ionic version: [x] 4.4.0. Current behavior: Label with position float disappears when get focused to ion-input.
Read more >
Ion-label 'floating' not working together with ion-label 'error'
Using Ionic 6.0.1, I find that slot=error and position=floating break the UI when used together. The problem is illustrated in this screen ...
Read more >
ion-label does not disappear when in browser with mobile ...
and when i set the browser toogle device toolbar with android mode, the content in ion-label did not disappear, like this.
Read more >
5 Examples of the new Ionic 6 Bottom Sheet Modal
Get the details on how to use the brand new Ionic Bottom Sheet component in this guest blog post from Simon Grimm.
Read more >
Don't Use The Placeholder Attribute - Smashing Magazine
The floating label effect, a close cousin to this phenomenon, oftentimes utilizes the placeholder attribute in place of a label , as well....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found