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 labels: Artificial label background clashing with autofill / per-field styling #40551

Closed
3 tasks done
Bouke opened this issue Jun 11, 2024 · 1 comment
Closed
3 tasks done
Labels

Comments

@Bouke
Copy link

Bouke commented Jun 11, 2024

Prerequisites

Describe the issue

I have a sign-in form with a floating label, like this:

image

When I use Safari Autofill (password manager), Safari applies a custom background to let the user know the field was filled in by the browser:

image

The CSS that is applied on the input is the following:

input:autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable, input:-webkit-autofill-and-obscured {
  background-color: rgb(250, 255, 189);
  background-image: none;
  color: rgb(0, 0, 0);
}

Disabling the artificial background fixes the field's rendering:

image

The artificial was introduced in #37125. It seems the fix was applied rather broadly on all input elements, rather than the element for which the issue was reported (textarea). Is an input even susceptible to the reported bug?

Reduced test cases

<div class="form-floating mb-3">
  <input type="email" class="form-control" id="floatingInput" placeholder="name@example.com" style="background:rgb(250, 255, 189)">
  <label for="floatingInput">Email address</label>
</div>

This is the outcome on v5.3.3 is different from 5.2.2 that I've shown above, but I think is still not looking great:

image

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Safari

What version of Bootstrap are you using?

v5.3.3

@julien-deramond
Copy link
Member

Thanks for reporting an issue @Bouke

We merged recently #39720 that fixes this issue. It will be available in the v5.3.4.

You can check this out at https://codepen.io/julien-deramond/pen/GRaxKVJ where the new rendering with Safari is:

Screenshot 2024-06-20 at 09 15 57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants