Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions packages/material-ui/src/InputBase/InputBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ export const InputBaseComponent = styled('input', {
}),
};
});

const InputGlobalStyles = React.memo(() => (
<GlobalStyles
styles={{
'@keyframes mui-auto-fill': { from: { display: 'block' } },
'@keyframes mui-auto-fill-cancel': { from: { display: 'block' } },
}}
/>
));

/**
* `InputBase` contains as few styles as possible.
* It aims to be a simple building block for creating an input.
Expand Down Expand Up @@ -483,12 +493,7 @@ const InputBase = React.forwardRef(function InputBase(inProps, ref) {

return (
<React.Fragment>
<GlobalStyles
styles={{
Copy link
Member

Choose a reason for hiding this comment

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

Just learned that @babel/plugin-transform-constant-elements deopts mutable props. This unlocks a bunch of optimizations actually since we treat props as immutable all the time. Will investigate in a follow-up.

'@keyframes mui-auto-fill': {},
'@keyframes mui-auto-fill-cancel': {},
}}
/>
<InputGlobalStyles />
<Root
{...rootProps}
{...(!isHostComponent(Root) && {
Expand Down