Skip to content

Commit 9831c8c

Browse files
authored
[InputBase] Fix autofill issue (#28070)
1 parent a0070a8 commit 9831c8c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

packages/material-ui/src/InputBase/InputBase.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,16 @@ export const InputBaseComponent = styled('input', {
212212
}),
213213
};
214214
});
215+
216+
const inputGlobalStyles = (
217+
<GlobalStyles
218+
styles={{
219+
'@keyframes mui-auto-fill': { from: { display: 'block' } },
220+
'@keyframes mui-auto-fill-cancel': { from: { display: 'block' } },
221+
}}
222+
/>
223+
);
224+
215225
/**
216226
* `InputBase` contains as few styles as possible.
217227
* It aims to be a simple building block for creating an input.
@@ -483,12 +493,7 @@ const InputBase = React.forwardRef(function InputBase(inProps, ref) {
483493

484494
return (
485495
<React.Fragment>
486-
<GlobalStyles
487-
styles={{
488-
'@keyframes mui-auto-fill': {},
489-
'@keyframes mui-auto-fill-cancel': {},
490-
}}
491-
/>
496+
{inputGlobalStyles}
492497
<Root
493498
{...rootProps}
494499
{...(!isHostComponent(Root) && {

0 commit comments

Comments
 (0)