Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[input] Fix layout shift with display: flex #43839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
38 changes: 38 additions & 0 deletions docs/pages/experiments/base/autofill.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as React from 'react';
import Button from '@mui/material/Button';
import TextField from '@mui/material/TextField';
import Box from '@mui/material/Box';

export default function Autofill() {
return (
<Box component="form" sx={{ maxWidth: 400, m: 2 }}>
<TextField
id="email"
type="email"
name="email"
label="Email"
placeholder="[email protected]"
autoComplete="email"
autoFocus
required
fullWidth
variant="outlined"
/>
<TextField
name="password"
label="Password"
placeholder="••••••"
type="password"
id="password"
autoComplete="current-password"
autoFocus
required
fullWidth
variant="outlined"
/>
<Button type="submit" fullWidth variant="contained">
Sign in
</Button>
</Box>
);
}
4 changes: 2 additions & 2 deletions packages/mui-material/src/InputBase/InputBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ export const InputBaseInput = styled('input', {
);

const InputGlobalStyles = globalCss({
'@keyframes mui-auto-fill': { from: { display: 'block' } },
'@keyframes mui-auto-fill-cancel': { from: { display: 'block' } },
'@keyframes mui-auto-fill': {},
'@keyframes mui-auto-fill-cancel': {},
Comment on lines +260 to +261
Copy link
Member

Choose a reason for hiding this comment

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

Why not removing the InputGlobalStyles entirely?

Copy link
Member Author

Choose a reason for hiding this comment

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

Per the history of those lines, it was required for the autofill detection logic to work. But, ok, I didn't test if it's still true.

Copy link
Member

Choose a reason for hiding this comment

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

If this trick involving the dummy animation to expose a JS hook still works, it may be needed to fix #44135 (comment)

});

/**
Expand Down