Skip to content

fix(input): improve autofill#2298

Open
desig9stein wants to merge 4 commits into
masterfrom
mpopov/fix-autofill
Open

fix(input): improve autofill#2298
desig9stein wants to merge 4 commits into
masterfrom
mpopov/fix-autofill

Conversation

@desig9stein

@desig9stein desig9stein commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
  • Refactored input text color logic to use a custom property (--input-text-color) for compatibility with autofill behavior in WebKit and Chromium.
  • Replaced transition-delay hack with background-clip: text and -webkit-text-fill-color to ensure proper rendering of autofilled inputs, especially in scenarios like floating labels in the material theme.

Description

Provide a clear and concise summary of the changes in this PR and the motivation behind them

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to change)
  • Documentation update
  • Refactoring (code improvements without functional changes)

Related Issues

Closes #2289

Testing

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • I have updated documentation if needed
  • Breaking changes are documented in the description

…l-color`

- Refactored input text color logic to use a custom property (`--input-text-color`) for compatibility with autofill behavior in WebKit and Chromium.
- Replaced transition-delay hack with `background-clip: text` and `-webkit-text-fill-color` to ensure proper rendering of autofilled inputs, especially in scenarios like floating labels in the material theme.
@desig9stein
desig9stein requested a review from simeonoff July 24, 2026 10:34
Copilot AI review requested due to automatic review settings July 24, 2026 10:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses broken autofill styling in the igc-input component (notably in Material/outlined scenarios) by changing how input text color is authored and by replacing the previous autofill “transition-delay” workaround with a rendering approach based on text clipping and -webkit-text-fill-color.

Changes:

  • Mirror input text color into a custom property (--input-text-color) so autofilled fields can reliably use it via -webkit-text-fill-color.
  • Replace the previous autofill transition-delay hack with background-clip: text + -webkit-text-fill-color to prevent the UA autofill background from covering floating labels (especially on first render with autofill).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/components/input/themes/shared/input.material.scss Sets --input-text-color for the Material filled-input part token and uses it for color.
src/components/input/themes/shared/input.common.scss Introduces --input-text-color as the source of truth for input text color across common states.
src/components/input/themes/input.base.scss Updates the autofill styling approach to clip the autofill background to text and paint text via -webkit-text-fill-color.

Comment thread src/components/input/themes/input.base.scss
Copilot AI review requested due to automatic review settings July 24, 2026 10:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread src/components/input/themes/input.base.scss Outdated
Comment thread src/components/input/themes/input.base.scss Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 24, 2026 10:52
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +45 to +54
// Chromium and WebKit paint an opaque background and a fixed text color on
// autofilled fields through UA styles marked as !important, which cannot be
// overridden by author styles. Without this the autofill background covers the
// floating label in the material theme.
// Clipping the background to the text makes it invisible, while the text itself
// is painted through `-webkit-text-fill-color`, which takes precedence over the
// UA `color`. Both are static declarations on purpose - the previous
// transition-delay hack only held back the background as long as a transition
// could actually run, so inputs first rendered while already autofilled
// (a login form in a dialog, for instance) still got the UA styling.
@simeonoff

Copy link
Copy Markdown
Collaborator

@desig9stein Fix the lint errors please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input broken autofill styling - outlined, material

4 participants