Skip to content

Commit

Permalink
add comment back
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Sep 27, 2023
1 parent ab48f3f commit 5da55f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,13 @@ function BaseTextInput(props) {
// Activate or deactivate the label when either focus changes, or for controlled
// components when the value prop changes:
useEffect(() => {
if (hasValue || isFocused || isInputAutoFilled(input.current)) {
if (
hasValue ||
isFocused ||
// If the text has been supplied by Chrome autofill, the value state is not synced with the value
// as Chrome doesn't trigger a change event. When there is autofill text, keep the label activated.
isInputAutoFilled(input.current)
) {
activateLabel();
} else {
deactivateLabel();
Expand Down

0 comments on commit 5da55f7

Please sign in to comment.