Skip to content

bug: floating label is not centered in input on ios mode #20153

Closed

Description

@gugahoi

Bug Report

Ionic version:

[x] react 4.11.0

Current behavior:
IonLabel is positioned incorrectly in iOS only. It seems IonLabel is far too low when used in an input box for iOS user agents. It is positioned correctly for Web and Android user agents however - refer to screenshots below.

Expected behavior:
iOS labels should be centered just like in the Web or Android version

Steps to reproduce:
Using the dark theme described in the documentation and trying to use floating labels. No other styling changes required.

Related code:

// Input.tsx
import React from 'react'
import { TextFieldTypes } from '@ionic/core'
import { IonInput, IonItem, IonLabel } from '@ionic/react'

type InputProps = {
    placeholder: string
    type?: TextFieldTypes
}

const Input = ({ placeholder, type = 'text' }: InputProps) => (
    <IonItem className='ion-margin-vertical'>
        <IonLabel position='floating'>{placeholder}</IonLabel>
        <IonInput type={type} />
    </IonItem>
)

export default Input

Using it like below

<form>
    <Input type='email' placeholder='Email Address' />
    <Input type='password' placeholder='Password' />
    <IonButton
        expand='block'
        onClick={submit}
        type='submit'
    >
        Sign In
    </IonButton>
</form>

Other information:

Screenshot with iOS user agent

It is quite easy to see how the Password label is misplaced (specially when comparing to the android screenshot), however when selecting the input box, the label floats correctly.

Screen Shot 2020-01-07 at 3 51 40 pm

Screenshot with Android user agent

Screen Shot 2020-01-07 at 3 51 27 pm

Ionic info:

> ionic info

Ionic:

   Ionic CLI       : 5.4.13 (/usr/local/lib/node_modules/ionic)
   Ionic Framework : @ionic/react 4.11.7

Capacitor:

   Capacitor CLI   : 1.4.0
   @capacitor/core : 1.4.0

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v13.2.0 (/usr/local/Cellar/node/13.2.0/bin/node)
   npm    : 6.13.1
   OS     : macOS Catalina

Activity

  1. changed the title [-]bug: IonLabel not centered correctly inside input fields on iOS devices[/-] [+]bug: floating label is not centered in input on ios mode[/+] on May 3, 2022
  2. added
    package: core
    type: bug
    on May 3, 2022
  3. added
    type: bug
    and removed
    type: bug
    on Nov 2, 2022
  4. added a commit that references this issue on Nov 15, 2022
    44472ae
  5. liamdebeasi commented on Nov 15, 2022

    @liamdebeasi
    Contributor

    Thanks for the report. In Ionic 7 we will be introducing a new syntax for using form components such as ion-input. You can find a summary of the changes here: #25661

    The reported issue is fixed with this new syntax. Work to update ion-input to use this new syntax has been completed, so I am going mark this issue as resolved. We plan to have a public beta period for Ionic 7 in the future. You can visit the Ionic Blog, Ionic Twitter, or our GitHub Releases Page to be notified when the Ionic 7 beta is released. Let me know if you have any questions. Thanks!

  6. ionitron-bot commented on Dec 15, 2022

    @ionitron-bot

    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.

  7. locked and limited conversation to collaborators on Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: coretype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions