Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating label is not yet on top of the inputbox when prefilled by Chrome #2358

Closed
zouterover opened this issue Oct 21, 2021 · 1 comment
Closed
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@zouterover
Copy link

zouterover commented Oct 21, 2021

On Chrome Version 94.0.4606.81 (Official Build) (arm64) inputboxes are prefilled, however the floating label is not yet on top of the box (see first image). As soon as I click the page the label does float on top (second image).

Expected behavior: When input boxes are prefilled the label should be on top.

I checked Safari and Firefox and there this is not an issue.
Screen Shot 2021-10-21 at 16 11 16

Screen Shot 2021-10-21 at 16 21 24

Used code:

  <div className="field mt-6">
      <span className="p-float-label p-input-icon-right">
          <i className="pi pi-envelope"/>
          <Controller name="email" control={control}
                      rules={{
                          required: 'Email is verplicht.',
                          pattern: {
                              value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
                              message: 'Email is ongeldig.'
                          }
                      }}
                      render={({field, fieldState}) => (
                          <InputText id={field.name} {...field}
                                     className={classNames({'p-invalid': fieldState.invalid})}/>
                      )}/>
          <label htmlFor="email"
                 className={classNames({'p-error': !!errors.email})}>E-mailadres</label>
      </span>
      {getFormErrorMessage('email')}
  </div>

@melloware
Copy link
Member

I actually think this might be a Chrome issue where when it fills out an AutoComplete form it doesn't register any event on the Input box for the placeholder code to be triggered by.

See this Stack Overflow answer: https://stackoverflow.com/a/11710295/502366

@mertsincan mertsincan self-assigned this Nov 3, 2021
@mertsincan mertsincan added the Type: Bug Issue contains a defect related to a specific component. label Nov 3, 2021
@mertsincan mertsincan added this to the 7.0.0.Final milestone Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

3 participants