Skip to content

Commit 3a21a88

Browse files
leticiarossidsn5ft
authored andcommitted
Updating filled text fields to use new colors for states a11y.
PiperOrigin-RevId: 275024556
1 parent c47e6a4 commit 3a21a88

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

lib/java/com/google/android/material/textfield/TextInputLayout.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,15 +3506,13 @@ void updateTextInputBoxState() {
35063506
if (!isEnabled()) {
35073507
boxStrokeColor = disabledColor;
35083508
} else if (indicatorViewController.errorShouldBeShown()) {
3509-
// TODO(b/124130133): remove check for boxBackgroundMode
3510-
if (boxBackgroundMode == BOX_BACKGROUND_OUTLINE && strokeErrorColor != null) {
3509+
if (strokeErrorColor != null) {
35113510
updateStrokeErrorColor(hasFocus, isHovered);
35123511
} else {
35133512
boxStrokeColor = indicatorViewController.getErrorViewCurrentTextColor();
35143513
}
35153514
} else if (counterOverflowed && counterView != null) {
3516-
// TODO(b/124130133): remove check for boxBackgroundMode
3517-
if (boxBackgroundMode == BOX_BACKGROUND_OUTLINE && strokeErrorColor != null) {
3515+
if (strokeErrorColor != null) {
35183516
updateStrokeErrorColor(hasFocus, isHovered);
35193517
} else {
35203518
boxStrokeColor = counterView.getCurrentTextColor();
@@ -3531,20 +3529,16 @@ void updateTextInputBoxState() {
35313529
getErrorIconDrawable() != null && indicatorViewController.errorShouldBeShown());
35323530

35333531
// Update icons tints
3534-
// TODO(b/124130133): remove check for boxBackgroundMode
3535-
if (boxBackgroundMode == BOX_BACKGROUND_OUTLINE) {
3536-
updateIconColorOnState(errorIconView, errorIconTintList);
3537-
updateIconColorOnState(startIconView, startIconTintList);
3538-
updateIconColorOnState(endIconView, endIconTintList);
3539-
}
3532+
updateIconColorOnState(errorIconView, errorIconTintList);
3533+
updateIconColorOnState(startIconView, startIconTintList);
3534+
updateIconColorOnState(endIconView, endIconTintList);
35403535

35413536
if (getEndIconDelegate().shouldTintIconOnError()) {
35423537
tintEndIconOnError(indicatorViewController.errorShouldBeShown());
35433538
}
35443539

35453540
// Update the text box's stroke width based on the current state.
3546-
// TODO(b/124130133): Update the if check to only (hasFocus && isEnabled)
3547-
if ((hasFocus || (boxBackgroundMode == BOX_BACKGROUND_FILLED && isHovered)) && isEnabled()) {
3541+
if (hasFocus && isEnabled()) {
35483542
boxStrokeWidthPx = boxStrokeWidthFocusedPx;
35493543
} else {
35503544
boxStrokeWidthPx = boxStrokeWidthDefaultPx;
@@ -3554,7 +3548,7 @@ void updateTextInputBoxState() {
35543548
if (boxBackgroundMode == BOX_BACKGROUND_FILLED) {
35553549
if (!isEnabled()) {
35563550
boxBackgroundColor = disabledFilledBackgroundColor;
3557-
} else if (isHovered) {
3551+
} else if (isHovered && !hasFocus) {
35583552
boxBackgroundColor = hoveredFilledBackgroundColor;
35593553
} else {
35603554
boxBackgroundColor = defaultFilledBackgroundColor;

0 commit comments

Comments
 (0)