์ด๊ธฐ ํ์ด์ง๋ก๋์ ํฌ๋กฌ์ด ํ
์คํธ ์์๋ฅผ ๋ฏธ๋ฆฌ ์ฑ์ธ ๋ TextField ๊ฐ์ ๋ณํ์ ํ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์๋์ผ๋ก ์ฑ์์ง ํ
์คํธ๊ฐ ๋ ์ด๋ธ์ ๋ฎ์ด ์๋๋ค. ์๋ ์คํฌ๋ฆฐ ์ท์ ์ฐธ์กฐํ์ญ์์ค.
๋ํ ์๋์ผ๋ก ์ฑ์์ง ํ ์คํธ์ ๋ ธ๋์ ๋ฐฐ๊ฒฝ์ด ์์ต๋๋ค. ์ฌ์ ์ ํ ์ ์์ต๋๊น?
MUI ๋ฒ์ 3.9.2
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํด์ผํฉ๋๋ค! # 14453์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ช ๊ฐ์ง ๋ฐฉ๋ฒ์ ์ ๊ณต ํ ์ ์์ต๋๋ค.
@garygrubb ๊ถ๊ธํฉ๋๋ค. ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ์ง์์ ์ผ๋ก ์ฌ์ฉํ ์์๋ ์ฌํ ์์ ๋ฅผ ๋ง๋ค ์ ์์ต๋๊น? ๊ฐ์ฌํฉ๋๋ค! ์ด๊ฒ์ Google ๊ธฐ๋ณธ ๋ก๊ทธ์ธ ์์๊ณผ ๋งค์ฐ ์ ์ฌํฉ๋๋ค.
์๋ต์ด ์ง์ฐ๋์ด ์ฃ์กํฉ๋๋ค. ๋๋ ์ด๋ฒ ์ฃผ ํ๋ฐ์ ์๊ฐ์ด ํ๋ฝ๋๋ฉด ์์ ๋ณต์ ํ์ ๋ง๋ค๋ ค๊ณ ๋ ธ๋ ฅํ ๊ฒ์ ๋๋ค. ๊ทธ ๋์ ์์ ์์ ์ด ์์ต๋๋ค. Textfield ์ค ํ๋์ autoFocus๋ฅผ ์ค์ ํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ฉ๋๋ค.
` <TextField
required
**autoFocus**
variant="outlined"
id="username"
label="mobile number"
defaultValue=""
margin="normal"
name="username"
type="tel"
onChange={this.handleChange}
error={!this.state.validMobile}
autoComplete="tel-national username"
/>
ํ ์คํธ ํ๋ ์ค ํ๋์ autoFocus๋ฅผ ์ค์ ํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ฉ๋๋ค.
๋๋ฅผ ์ํด ์๋ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ํ ์๋์ผ๋ก ์ฑ์์ง ํ ์คํธ์ ๋ ธ๋์ ๋ฐฐ๊ฒฝ์ด ์์ต๋๋ค. ์ฌ์ ์ ํ ์ ์์ต๋๊น?
@garygrubb ํ ๋ง ์ฌ์ ์๋ฅผ ํตํด์ด ์์ ์ ์ํํ์ต๋๋ค.
const theme = createMuiTheme({
overrides: {
MuiInputBase: {
input: {
'&:-webkit-autofill': {
transitionDelay: '9999s',
transitionProperty: 'background-color, color',
},
},
},
},
});
์ด์์ ์ด์ง๋ ์์ง๋ง ๋ฌด์ธ๊ฐ์ ๋๋ค.
๋์์ ์์ ๊ทธ๋ฆผ์๋ฅผ ์ฌ์ฉํ์ฌ ์ ๋ ฅ์ ์ฑ์ฐ๋ ๊ฒ์ ๋๋ค : https://stackoverflow.com/questions/2781549/removing-input-background-colour-for-chrome-autocomplete
@oliviertassinari ์ด๊ฒ์ ํธ๋ฆญ์ ํ ์ ์์ต๋๋ค : https://stackoverflow.com/a/41530164/396889
๋ํ ์ฐธ๊ณ : https://github.com/facebook/react/issues/1159
@MarkMurphy ๋ฌธ์ ๋ฅผ ์ด๋ป๊ฒ ์ฌํ ํ ์ ์๋์ง
@MarkMurphy ๋ฌธ์ ๋ฅผ ์ด๋ป๊ฒ ์ฌํ ํ ์ ์๋์ง
๋๋ฅผ ์ํด ๊ฐ๋จํ ์ฌ์ฉ์ ์ด๋ฆ๊ณผ ๋น๋ฐ๋ฒํธ ์์์ ๋ง๋ค๊ณ Chrome์ด ๋ด ์๊ฒฉ ์ฆ๋ช ์ ๊ธฐ์ตํ๋๋ก ํ์ฉํ์ต๋๋ค.
MacOS High Sierra 10.13.6์์ Chrome 72.0.3626.119 ์ฌ์ฉ
@ material-ui / core ๋ฒ์ "3.8.1"
@ material-ui / styles ๋ฒ์ "3.0.0-alpha.6"
@MarkMurphy https://material-ui.com/getting-started/page-layout-examples/sign-in/์ผ๋ก ์ฌํ ํ ์
์ด๊ฒ์ ํ ์คํธ ํ๋ ํ์ค ๋ณํ์ ๋๋ค. ๋ฐ๋ผ์ ๋ ๊ฐ์ง ๋ฌธ์ ๋ฅผ ์ ์ ์์ต๋๋ค.
์ง๊ธ ์ค๋ช ๋ ๋ณํ์ ์ฌ์ฉํด ๋ณด๊ฒ ์ต๋๋ค. ์ด ํ์ด์ง๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค : https://deploy-preview-14499--material-ui.netlify.com/getting-started/page-layout-examples/sign-in-side/
ํฌ๋กฌ ์๋ ์์ฑ ๋ฌธ์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค. ํฌ๋กฌ์ ์๋ ์์ฑ์ ๊ฐ์งํ๋ ๋ฐฉ๋ฒ์ด ์ ๊ณต ๋์๋ค๋ฉด ์ฝ๊ฒ ๊ณ ์น ์ ์์ง๋ง ํด๊ฒฐ์ฑ ์ ์์ง ๋ชปํฉ๋๋ค. ์ ์ผํ ํด๊ฒฐ์ฑ ์ ๋ชจ๋ ํ ์คํธ ํ๋์ ๋ํด ์๋ ์์ฑ / ์๋ ์์ฑ์ ๋๋ ๊ฒ์ ๋๋ค.
@ ymoon715 ์์ ๋งํฌ๋ฅผ ๊ฒ์ ํ ๋ค๋ฅธ ์คํ ๊ฐ๋ฅํ ์๋ฃจ์ ์ด ํ๋
ํด๊ฒฐ ๋ฐฉ๋ฒ ๋ฌธ์ :
์ฌ์ ์ ์คํ์ผ : http://webagility.com/posts/the-ultimate-list-of-hacks-for-chromes-forced-yellow-background-on-autocompleted-inputs
์๋ ์์ฑ ์คํ์ผ ๋นํ์ฑํ (์ ๋ ๋ฒ์งธ ๋งํฌ์ ์ค ๋ํซ) :
input:-webkit-autofill,
.my-class:-webkit-autofill {
-webkit-transition-delay: 9999999s;
}
๊ฐ์ฌํฉ๋๋ค @cezarderevlean , ๋
ธ๋์ ๋ฐฐ๊ฒฝ์ ์ ๊ฑฐํ์ต๋๋ค. ์ด์ ํ์์ผ๋ก ํ์๋ ๋์ฐ๋ฏธ ํ
์คํธ๋ฅผ ์ ๊ฑฐํ๋ ๋ฐฉ๋ฒ์ ์์ ๋ด๋ฉด๋ฉ๋๋ค.
์์ ๋ฃ์ ์ฒซ ๋ฒ์งธ ๋งํฌ์ ์ค๋ช
๋๋๋ก ์๋ ์์ฑ์ "๋นํ์ฑํ"ํ์ง ์์ผ๋ ค๋ฉด ์๋ ์์ฑ ํ์๋ ์ฝ๋ ๋ณ๊ฒฝ์ผ๋ก ์ธํด ํ์ด์ง๊ฐ ์๋ก ๊ณ ์ณ์ง ๊ฒฝ์ฐ์๋ง ์คํฌ๋ฆฐ ์ท์ฒ๋ผ ๋ํ๋ฉ๋๋ค.
๊ฐ๋ฐ (๋ด๊ฐ ํ
์คํธ ํ ํ). ์ ์์ ์ธ ๋ธ๋ผ์ฐ์ ๋ก๋ / ์๋ก ๊ณ ์นจ์ ๊ด์ฐฎ์ ๊ฒ์ด๋ฉฐ ์๋ฆฌ ํ์์๊ฐ ์ค์ด๋ค ๊ฒ์
๋๋ค.
๋ํ ์์์ ๋งํ ๊ฒ์ด ์ฌ์ค์ด ์๋๋ผ๋ฉด ๊ตฌํํ ์์๋ ํ ๊ฐ์ง ํด๊ฒฐ ๋ฐฉ๋ฒ์ ํญ์ TextField
์์์ด ์ํ์ผ๋ก ์๋ฆฌ ํ์์๋ฅผ ์ถ์ํ๋ ๊ฒ์
๋๋ค.
InputLabelProps={{
shrink: true,
}}
@cezarderevlean ๊ฐ์ฌํฉ๋๋ค. ๋น์ ์ด ์ณ์ต๋๋ค. ์ ์์ ์ธ ๋ธ๋ผ์ฐ์ ์๋ก ๊ณ ์นจ์ด ์ ๋๋ก ์๋ํฉ๋๋ค.
๋๋ ๊ทธ๊ฒ์ ๋์น ๋ฐฉ๋ฒ์ ๋ชจ๋ฅด์ง๋ง @MarkMurphy ๋ ๋น์ทํ ํด๊ฒฐ์ฑ ์ ๊ฐ์ง๊ณ ์์๊ณ ์ฌ์ฉ ์ฌ๋ก์ ๋ํด ์ฝ๊ฐ ๋ ๊นจ๋ํ ์ฌ๋ฃ ํ ๋ง ์ฌ์ ์๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๊ฐ์ฌํฉ๋๋ค ๋งํฌ.
์์ ๋ฃ์ ์ฒซ ๋ฒ์งธ ๋งํฌ์ ์ค๋ช ๋๋๋ก ์๋ ์์ฑ์ "๋นํ์ฑํ"ํ์ง ์์ผ๋ ค๋ฉด ์๋ ์์ฑ ํ์๋ ์ฝ๋ ๋ณ๊ฒฝ์ผ๋ก ์ธํด ํ์ด์ง๊ฐ ์๋ก ๊ณ ์ณ์ง ๊ฒฝ์ฐ์๋ง ์คํฌ๋ฆฐ ์ท์ฒ๋ผ ๋ํ๋ฉ๋๋ค.
๊ฐ๋ฐ (๋ด๊ฐ ํ ์คํธ ํ ํ). ์ ์์ ์ธ ๋ธ๋ผ์ฐ์ ๋ก๋ / ์๋ก ๊ณ ์นจ์ ๊ด์ฐฎ์ ๊ฒ์ด๋ฉฐ ์๋ฆฌ ํ์์๊ฐ ์ค์ด๋ค ๊ฒ์ ๋๋ค.๋ํ ์์์ ๋งํ ๊ฒ์ด ์ฌ์ค์ด ์๋๋ผ๋ฉด ๊ตฌํํ ์์๋ ํ ๊ฐ์ง ํด๊ฒฐ ๋ฐฉ๋ฒ์ ํญ์
TextField
์์์ด ์ํ์ผ๋ก ์๋ฆฌ ํ์์๋ฅผ ์ถ์ํ๋ ๊ฒ์ ๋๋ค.InputLabelProps={{ shrink: true, }}
๊ณ ๋ง์, ์ด๊ฒ์ ๋๋ฅผ ์ํด ์ผํ๋ค.
์ฌ์ฉ์ ์ด๋ฆ ํ๋์ autoFocus
์ ์ค์ ํ๊ณ ์ํธ ํ๋์ autoComplete='new-password'
์ค์ ํ๋ ๊ฒ๋ ๋์๊ฒ ํธ๋ฆญ์ ์ ๊ณตํ์ต๋๋ค.
์ ๋ฐ์ดํธ : ์ฌ๊ธฐ์ ์ด์ ์ ๊ฒ ๊ฐ์ต๋๋ค. ์ด์ ๋ ๋ฌด์์ ๋๊น?
๊ฐ์ ์กด์ฌ๋ฅผ ๊ฐ์งํ๋ ๋์ (https://github.com/mui-org/material-ui/issues/14427#issuecomment-466054906 ์ฐธ์กฐ) ์ ๋ ฅ์ ์ค์ ๊ฐ์ ์ป๊ณ ์ํ๋ ์ฌ๋๋ค์ ์ํด, I ' ์ด SO ๋ฌธ์์ ์์ธํ ์ค๋ช ๋ ์๋ฃจ์ ์ด ์์ต๋๋ค. https://stackoverflow.com/questions/35049555/chrome-autofill-autocomplete-no-value-for-password/56157489#56157489. ๋งํฌ์๋ ์ผ๋ฐ์ ์ผ๋ก Chrome์ ์ํฅ์ ๋ฏธ์น๋์ด ์ ๋ฐ์ ์ธ ๋ฌธ์ ์ ๋ํ ์ข์ ๊ธฐ๋ก์ด ์์ต๋๋ค.
componentDidMount() {
var evt = new MouseEvent("click", {
view: window,
clientX: 0
});
window.dispatchEvent(evt);
let iterations = 0;
const interval = setInterval(() => {
const value = this.inputs.email.value;
// plain js alternative:
// const value = document.getElementById("email").value;
if (!!value || iterations > 20) {
console.log(value);
return clearInterval(interval);
}
iterations++;
console.log("not found -> repeat");
}, 100);
}
๊ธฐ๋ณธ์ ์ผ๋ก ์ ๋ ฅ์ ๋ง์ฐ์ค๋ฅผ ๊ฐ์ ๋ก ํด๋ฆญํ์ฌ Chrome์ด ์ ๋ ฅ์ ๊ฐ์ ์ค์ ํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ ๋์ค์ ๊ฐ์ด ์ค๋น๋๋ฉด ๊ฐ์ ๊ฐ์ ธ์ต๋๋ค. ํ์คํ ํดํค์ด์ง๋ง Chrome์ ์ต์ ์ด ์์ต๋๋ค ... (SO ๊ธฐ์ฌ์์ Chrome์ ์์ธ์ ๋ํ ์์ธํ ๋ด์ฉ ์ฐธ์กฐ).
์์ฝ : ์ด๊ฒ์ ๋ธ๋ผ์ฐ์ ๋ฌธ์ ์ ๋๋ค. ์์์ ์๋์ผ๋ก ์ฑ์ธ ๋ ์ ๋ ฅ ์ด๋ฒคํธ๋ฅผ ์ผ๊ด๋๊ฒ ์คํํ์ง ์์ต๋๋ค.
์ด๊ฒ์ ๋ธ๋ผ์ฐ์ ์์ค์ ๋ฌธ์ ์ ๋๋ค. ํ์ด์ง ๋ด๋ถ๋ฅผ ํด๋ฆญ ํ ๋ค์ ๋ค์๋ก๋ํ๋ฉด ์ ๋ ฅ ์ด๋ฒคํธ๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ฌ๋ฉ๋๋ค. ํ์ด์ง๋ฅผ ํด๋ฆญํ๋ฉด ๋ด๋น๊ฒ์ด์ ๋ฐ๋ฅผ ํด๋ฆญํ๋ฉด ๋ ๋ฒ์งธ ์ ๋ ฅ์์๋ง ์๋์ด ์ค์ง๋ฉ๋๋ค. ํ์ด์ง์ ๋ํ ๋งํฌ๋ฅผ ๋ณต์ฌํ๊ณ navbar์ ์ ๋ ฅํ์ฌ ํ์ด์ง์ ๋์ฐฉํ๋ฉด ์๋ํฉ๋๋ค.
ํด๋ง๋์์ ๋ ์๋์ผ๋ก ์ฑ์์ง๋๋ผ๋ ์ ๋ ฅ ๊ฐ์ด ์ฌ์ ํ ๋น์ด ์๊ธฐ ๋๋ฌธ์ ๋ชจ๋ ๋ธ๋ผ์ฐ์ ์์์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋์ง์กฐ์ฐจ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ํฌ๋กฌ๋ง์์ํ ๊น๋ํ ํธ๋ฆญ์ด ์์ต๋๋ค. Chrome์๋ง ์ด๋ฌํ ๋ฌธ์ ๊ฐ ์๋์ง ์กฐ์ฌํฉ๋๋ค.
@ eps1lon Chromium๊ณผ ๊ด๋ จ๋ ๊ฒฝ์ฐ Chromium์์ ๋ฒ๊ทธ๋ฅผ ์ด์์ต๋๊น?
์ด๊ฒ์ ๋๋ฅผ ์ํด ์๋ํ์ง ์์ต๋๋ค : https://github.com/mui-org/material-ui/issues/718#issuecomment -529064043.
์๋ํฉ๋๋ค : InputLabelProps = {{shrink : true}}, ๋น๋ก ํญ์ ์ถ์ ๋ ์ํ๋ก ์ ์ง๋ฉ๋๋ค.
๋ค์ ์ฐจ์ด์ ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
diff --git a/packages/material-ui/src/InputBase/InputBase.js b/packages/material-ui/src/InputBase/InputBase.js
index d258e5b71d..a7aebb1288 100644
--- a/packages/material-ui/src/InputBase/InputBase.js
+++ b/packages/material-ui/src/InputBase/InputBase.js
@@ -311,6 +311,10 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
}
};
+ // Check the input state on mount, in case it was filled by the user
+ // or auto filled by the browser before the hydration (for ssr).
+ React.useEffect(() => {
+ checkDirty(inputRef.current);
+ }, []);
+
const handleClick = event => {
if (inputRef.current && event.currentTarget === event.target) {
inputRef.current.focus();
๋๊ตฌ๋ ์ง ์์ ์ ํ์ง์ ํ์ธํ ์ ์์ต๋๊น?
@oliviertassinari ๋จธํฐ๋ฆฌ์ผ UI์ ์๋ํ๋ ๊ตฌ์ฑ ์์๊ฐ ์์ด์ผํ์ง๋ง ์์์ ์ธ๊ธ ํ @ eps1lon ๊ณผ ๊ฐ์ Chromium ๋ฒ๊ทธ ์ธ ๊ฒฝ์ฐ์ด ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ผ์์ ์ผ๋ก ๋ง ์์ ํด์ผํ๋ฉฐ ๋ฌธ์ ๋ Chromium ๋ด์์ ์์ ํด์ผํฉ๋๋ค. ์ด๊ฒ์ด Chromium์ ๋ฒ๊ทธ์ธ์ง ์๋๋ฉด MUI ๋ฒ๊ทธ์ธ์ง ํ์ธํ ์ ์์ต๋๊น?
Chromium ๋ฒ๊ทธ ์ธ ๊ฒฝ์ฐ์ด๋ฅผ ์ํด ํฌ๋กฌ์์ ์ด๋ฆฐ ๋ฒ๊ทธ๊ฐ ์๋์ง ํ์ธํด์ผํฉ๋๋ค. ์ ์ฌ : ํฌ๋กฌ ๊ฒ์ ๊ฒฐ๊ณผ
(https://github.com/mui-org/material-ui/issues/14427#issuecomment-524535710)
์ด ์์ ์์ Chrome์ ๋ฌธ์ ๋ผ๊ณ ์๊ฐํ์ง ์์ต๋๋ค. React์ ์๋ฒ ์ธก ๋ ๋๋ง ๋ฌธ์ ๋ผ๊ณ ์๊ฐํฉ๋๋ค. ์ฌ์ฉ์๊ฐ ์ ๋ ฅ์ ์ฝํ ์ธ ๋ฅผ ์์ฑํ๋ฉด React hydrate ์ ์๋ ์ด์ ๋ํ ์๋ฆผ์๋ฐ์ง ์์ต๋๋ค : https://github.com/facebook/react/issues/12955
@oliviertassinari ํ์ง๋ง create-react-app ๊ฐ๋ฐ ์๋ฒ์์ ์๋ฒ ์ธก ๋ ๋๋ง์ด ์ผ์ด๋์ง ์์ต๋๊น?
๋ฌธ์ ๋ onInput ๋๋ onChange ํธ๋ค๋ฌ๊ฐ ์๋ฐ ์คํฌ๋ฆฝํธ๋ฅผ ํตํด ์ค์ ๋์ด์ผ ํ ๊ฐ๋ฅ์ฑ์ด ๊ฐ์ฅ ๋์ต๋๋ค. ํฌ๋กฌ ์๋ ์์ฑ ํ์ ์ด๋ฐ ์ผ์ด ๋ฐ์ํ๋ฉด ์ด๋ฌํ ์ด๋ฒคํธ๊ฐ ์์ค๋ฉ๋๋ค. ์๋ฐ ์คํฌ๋ฆฝํธ๊ฐ ๋ง์์๋ก ์ด๋ฒคํธ๋ฅผ ์์ ๊ฐ๋ฅ์ฑ์ด ๋์์ง๋๋ค. React๋ ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ๋ ์๊ฐ์ ์ค์ด๊ธฐ์ํ ๋ ธ๋ ฅ์ ์์ํ์ต๋๋ค. ์ด๊ฒ์ ์ํ ๋ UI์ ๋์์ด ๋ ๊ฒ์ ๋๋ค.
๋ค๋ฅธ ๋ฌธ์ ๋ ๊ฐ์ด ์๋์ผ๋ก ์ฑ์์ ธ๋ input.value
๊ฐ ์ค์ ๋์ง ์๋ ๊ฒฝ์ฐ๊ฐ ์๋ค๋ ๊ฒ์
๋๋ค. ์๋ํ์ง ์์ ๋ถ์์ฉ (์ : ์์ ์ ํจ์ฑ ๊ฒ์ฌ)์ด์์ ๊ฐ๋ฅ์ฑ์ด์๋ ์
๋ ฅ์ ์ง์ค / ํ๋ฆฌ๊ฒ ํ ํ์ ๋ง.
์ฌํ ๊ฐ๋ฅํ ์๊ฐ ๊ฑฐ์์๋ ๋ณด๊ณ ์๊ฐ ๊ฑฐ์ ์๊ธฐ ๋๋ฌธ์์ด ๋ฌธ์ ๋ฅผ ์ ๋๋ก ์กฐ์ฌํ๋ ๊ฒ์ ๋งค์ฐ ์ด๋ ต์ต๋๋ค. ์ด๋ก ์ ์ผ๋ก @oliviertassinari https://github.com/mui-org/material-ui/issues/14427#issuecomment -530145849์ ์์ ์ด ์ ์ด๋ ์ปค๋ฒํด์ผํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ด์ง๋ง ๋ฌธ์ ๋ฅผ ์ ๋๋ก ์๋ณ ํ ๋๊น์ง ์์ ์ ์ ์ฉํด์๋ ์๋ฉ๋๋ค. ์ญ์ ๋ ์ด๋ฒคํธ.
@ eps1lon ํฅ๋ฏธ https://material-ui.com/getting-started/page-layout-examples/sign-in/ (๊ฐ๋ฐ ๋ชจ๋, ๋ด ๋ก์ปฌ ํ๊ฒฝ)์์ ์ฌํ ํ ์์๋ ์ ์ผํ ๋ฌธ์ ์ ์ด์ ์ ๋ง์ถ๊ณ ์์ต๋๋ค. ๋ง์ง๋ง ํ ์คํธ (๋ ๊ธฐ์ ์ผ๋ก ๋ณ๊ฒฝ ์ด๋ฒคํธ ์์ )๋ฅผ ์คํํ์ฌ "์ํ ์ ์ ํธ๋ฆฌ๊ฑฐ ๋ ์ด๋ฒคํธ"๊ฐ ๋ฌธ์ ์ ์์ธ์ธ์ง ํ์ธํด์ผํฉ๋๋ค. ์ ์ด๋ React๊ฐ https://github.com/facebook/react/issues/12955์ ๊ด์ฌ์ ๋ณด์ผ ๋๊น์ง ์ฒ๋ฆฌ ํ ๊ฐ์น๊ฐ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
@croraf CRA๋ก ๋ฌธ์ ๋ฅผ ์ด๋ป๊ฒ ์ฌํํฉ๋๊น?
"์ํ ์ ์ ํธ๋ฆฌ๊ฑฐ ๋ ์ด๋ฒคํธ"๋ฌธ์ ๊ฐ https://github.com/mui-org/material-ui/issues/14132#issuecomment -453657016์์๋ ์ฐ๋ฆฌ์๊ฒ ์ํฅ์ ๋ฏธ์น๋ค๊ณ ์๊ฐํฉ๋๋ค.
@oliviertassinari CRA๋ ์ฌ๊ธฐ์๋ ๊ด๋ จ์ด ์์ง๋ง ๋ค์ ์ฝ๋๋ฅผ CRA์ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค (์ด ์ฝ๋ ์๋ ๋ฐ์ค๋ ๋ด๋ถ์ ์ผ๋ก CRA๋ฅผ ์ฌ์ฉํ๊ธฐ๋ํฉ๋๋ค) : https://codesandbox.io/s/textinput-bug-hsv9m
A)์ด ์ฝ๋ ์๋ ๋ฐ์ค์์ ์ฌํํ๋ ค๋ฉด :
1) ์ ์ฐฝ์์์ด ์๋ ๋ฐ์ค์ ์ฑ ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ฅผ ์ฝ๋ ๋ค.
2) ์๊ฒฉ ์ฆ๋ช
์
๋ ฅ ๋ฐ ์ ์ฅ (Chrome ๋ํ ์์์์ ์ ์ฅ์ ์์ฒญํ ํ)
3) ์ฐฝ์ ์๋ก ๊ณ ์นจํ์ฌ ๋ฌธ์ ๋ฅผ ํ์ธํฉ๋๋ค (Chrome์ด ์๋ ์์ฑ์ ์ ์ฉํ๋ฏ๋ก). ์๋ก ๊ณ ์นจ์ ๋ฌธ์ ๊ฐ ์ผ๊ด๋๊ฒ ๋ํ๋์ง ์์ง๋ง F5 (๋น ๋ฅธ ์ด์ค ์๋ก ๊ณ ์นจ)๋ฅผ ๋ ๋ฒ ํด๋ฆญํ๋ฉด ๊ฑฐ์ ์ผ๊ด๋๊ฒ ์ฌํ๋ฉ๋๋ค.
B) ๋ํ ๋น์ทํ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค
1) codesandbox ์ฑ ๋ฏธ๋ฆฌ๋ณด๊ธฐ์์ (๋ณ๋์ ์ฑ ์ฐฝ์ ์์ง ์์).
2) ์์ ์์ฑ ๋ฐ ์ ์ถ (Chrome์ ์ฌ์ฉ์ ์ด๋ฆ / ๋น๋ฐ๋ฒํธ ์กฐํฉ ์ ์ฅ)
3) ์ฑ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋ง ๋ค์๋ก๋ํฉ๋๋ค. ์์์ ์ฆ์ ์๋์ผ๋ก ์ฑ์์ง์ง ์์ต๋๋ค. (material-ui sandbox์์ ์๋์ผ๋ก ์ฑ์์ง ํ๋ ๋ด์ฉ์ ์ญ์ ํ ์ ์์ต๋๋ค)
4) ์ฌ์ฉ์ ์ด๋ฆ ํ
์คํธ ํ๋๋ฅผ ํด๋ฆญํ์ญ์์ค. Chrome์ ์ฌ์ฉ์๋ฅผ ์ ํํ๋๋ก ์ ์ํฉ๋๋ค.
5) ์ฌ์ฉ์๋ฅผ ๊ฐ๋ฆฌํค๊ณ ์ํธ ํ๋์์ ๋ฐ์ํ๋ ๋ฌธ์ ๋ฅผ ํ์ธํฉ๋๋ค.
@ eps1lon ํธ๋ค๋ฌ๊ฐ ์ค์ ๋๊ธฐ ์ ์ Chrome์ด ์๋ ์์ฑ ๊ด๋ จ ์ด๋ฒคํธ๋ฅผ ์คํํ๋ ๋ฌธ์ ์ผ ์ ์์ต๋๋ค.
๊ทธ๋ฌ๋ React๊ฐ DOM์ ์ ๋ ฅ ํ์ผ์ ์์ฑํ๊ธฐ ์ ์ Chrome์ ์ด๋ป๊ฒ ์๋ ์์ฑ ํ ์ ์์ผ๋ฉฐ, JavaScript๊ฐ ์ด๋ฒคํธ ํธ๋ค๋ฌ๋ฅผ ์ค์ ํ๊ธฐ์ ์ถฉ๋ถํ๊ธฐ ์ ์ React๊ฐ DOM์์์ด๋ฅผ ์์ฑํ๋ ๋ฐฉ๋ฒ์ ๋ฌด์์ ๋๊น?
์ด๊ฒ์ ๋์๊ฒ ์์ํ ๊ฒ์ฒ๋ผ ๋ณด์ด๋ฉฐ SSR์์ ๋ฐ์ํ ์ ์์ต๋๋ค (์ด๋ป๊ฒ ์๋ํ๋์ง ๋ชจ๋ฅด๊ฒ ์ง๋ง). ๊ทธ๋ฌ๋ CRA ๊ฐ๋ฐ ์๋ฒ๋ SSR์ ์ฌ์ฉํ์ง ์์ต๋๋ค.
@ eps1lon ํธ๋ค๋ฌ๊ฐ ์ค์ ๋๊ธฐ ์ ์ Chrome์ด ์๋ ์์ฑ ๊ด๋ จ ์ด๋ฒคํธ๋ฅผ ์คํํ๋ ๋ฌธ์ ์ผ ์ ์์ต๋๋ค.
์ด๊ฒ์ ๋ฐ์์ ์ํด ์ํ๋๊ณ ํ์ฌ ์ฌ์์ฐ์ด ์์๊ธฐ ๋๋ฌธ์ ์ด๋ก ์ ์ผ๋ก ๋ง ๊ตฌ์ฑ๋ ์ ์ html์๋ง ์ ์ฉ๋ฉ๋๋ค. ์ด์ ์ค์ ๋ฌธ์ ๋ฅผ ์กฐ์ฌ ํ ์ ์์ต๋๋ค.
Chrome v76.0.3809.132, macOS v10.14.6์์ ๋ฌธ์ ๋ฅผ ์ฌํ ํ ์ ์์ต๋๋ค .
Chrome v76.0.3809.87, Windows 10์์ ๋ฌธ์ ์ ์ผ๋ถ๋ฅผ ์ฌํ ํ ์ ์์ต๋๋ค .
๋์ผํ ์ค์ ์ธ Chrome v76.0.3809.132, macOS v10.14.6์์ ๋ฌธ์ ๋ฅผ ์ฌํ ํ ์ ์์ต๋๋ค .
๋ด ์๋ฃจ์ :
import { isChrome, osName} from "react-device-detect";
.....
.....
const isChromeOSX = osName === 'Mac OS' && isChrome
const [shrink, setShrink] = useState(isChromeOSX ? true : undefined)
useEffect(() => {
if(isChromeOSX) {
const listen = () => {
setShrink(undefined)
window.removeEventListener('click',listen)
}
window.addEventListener('click', listen);
return () => {
window.removeEventListener('click',listen)
};
}
}, [])
return <TextField
.....
variant="outlined"
InputLabelProps={{ shrink }}
/>
๋ค์ diff๋ ๋ด๊ฐ ์ฌํ ํ ์์๋ ๋ฌธ์ ์ ๋ฐ์์ ํด๊ฒฐํฉ๋๋ค. ๋๊ตฐ๊ฐ ํ์ธํ ์ ์์ต๋๊น?
diff --git a/packages/material-ui/src/FormControl/FormControl.js b/packages/material-ui/src/FormControl/FormControl.js
index 0ede7ca404..c7cb22aeb9 100644
--- a/packages/material-ui/src/FormControl/FormControl.js
+++ b/packages/material-ui/src/FormControl/FormControl.js
@@ -145,6 +145,14 @@ const FormControl = React.forwardRef(function FormControl(props, ref) {
};
}
+ const onFilled = React.useCallback(() => {
+ setFilled(true);
+ }, []);
+
+ const onEmpty = React.useCallback(() => {
+ setFilled(false);
+ }, []);
+
const childContext = {
adornedStart,
disabled,
@@ -156,16 +164,8 @@ const FormControl = React.forwardRef(function FormControl(props, ref) {
onBlur: () => {
setFocused(false);
},
- onEmpty: () => {
- if (filled) {
- setFilled(false);
- }
- },
- onFilled: () => {
- if (!filled) {
- setFilled(true);
- }
- },
+ onEmpty,
+ onFilled,
onFocus: () => {
setFocused(true);
},
diff --git a/packages/material-ui/src/InputBase/InputBase.js b/packages/material-ui/src/InputBase/InputBase.js
index d258e5b71d..9cb6c94f43 100644
--- a/packages/material-ui/src/InputBase/InputBase.js
+++ b/packages/material-ui/src/InputBase/InputBase.js
@@ -116,6 +116,13 @@ export const styles = theme => {
'&$disabled': {
opacity: 1, // Reset iOS opacity
},
+ '&:-webkit-autofill': {
+ animationDuration: '5000s',
+ animationName: '$auto-fill',
+ },
+ },
+ '<strong i="6">@keyframes</strong> auto-fill': {
+ from: {},
},
/* Styles applied to the `input` element if `margin="dense"`. */
inputMarginDense: {
@@ -239,17 +246,20 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
}
}, [muiFormControl, disabled, focused, onBlur]);
+ const onFilled = muiFormControl && muiFormControl.onFilled;
+ const onEmpty = muiFormControl && muiFormControl.onEmpty;
+
const checkDirty = React.useCallback(
obj => {
if (isFilled(obj)) {
- if (muiFormControl && muiFormControl.onFilled) {
- muiFormControl.onFilled();
+ if (onFilled) {
+ onFilled();
}
- } else if (muiFormControl && muiFormControl.onEmpty) {
- muiFormControl.onEmpty();
+ } else if (onEmpty) {
+ onEmpty();
}
},
- [muiFormControl],
+ [onFilled, onEmpty],
);
useEnhancedEffect(() => {
@@ -311,6 +321,12 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
}
};
+ // Check the input state on mount, in case it was filled by the user
+ // or auto filled by the browser before the hydration (for SSR).
+ React.useEffect(() => {
+ checkDirty(inputRef.current);
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
+
const handleClick = event => {
if (inputRef.current && event.currentTarget === event.target) {
inputRef.current.focus();
@@ -354,6 +370,10 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
};
}
+ const handleAutoFill = () => {
+ // Provide a fake value as Chrome might not let you access it for security reasons.
+ checkDirty({ value: 'x' });
+ };
+
return (
<div
className={clsx(
@@ -399,6 +419,7 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
defaultValue={defaultValue}
disabled={fcs.disabled}
id={id}
+ onAnimationStart={handleAutoFill}
name={name}
onBlur={handleBlur}
onChange={handleChange}
ํ ๋ถ๋ถ์ https://github.com/tocco/tocco-client/commit/cb3b9b59994380f17c6650ffe4b63f96948072b6์์ ์๊ฐ์ ๋ฐ์์ต๋๋ค
material-ui sandbox (๋ฌธ์ ํ์ด์ง)๋ฅผ ์ฌ์ฉํ์ฌ์ด ์์ ์ฌํญ์ ๋ก์ปฌ์์ ํ
์คํธํ์ผ๋ฉฐ ์ ์ฉ ํ ๋ ๋ฌธ์ ๋ฅผ ์ฌํ ํ ์ ์์ต๋๋ค.
์ด๊ฒ์ด ๋ฌธ์ ์์ต๋๋ค.
์ด ์์ ์ผ๋ก https://github.com/mui-org/material-ui/issues/14427#issuecomment -530503051์ ํํธ B์ ์ธ๊ธ ๋ ์ ์ฌํ ๋ฌธ์ ๋ฅผ ์ฌํ ํ ์ ์์ต๋๋ค.
์ฌ๊ธฐ์์ ๋ณธ ๊ฒ :
@oliviertassinari @ eps1lon ๋น์ฆ๋์ค ์์ฉ ํ๋ก๊ทธ๋จ์์ v4.4.3์ ํ
์คํธํ๋๋ฐ ์ค๋ฅ๊ฐ ํ์๋์ง ์์์ต๋๋ค. (์ด์ฉ๋ฉด ๊ฐ์ฅ ์ฐ์ํ๋์ง๋ ์์ง๋ง) ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ณ ํญ์ ๋ ์ด๋ธ ์ ๊ธฐ์ ๋ด๊ฐ ํดํน์ ์ ๊ฑฐ ๊ทธ๊ฒ์ ํจ์น๋ฅผ ๋ณด์ธ๋ค ๊ทธ๋์ ( InputLabelProps={{ shrink: true }}
์ ๋ง ์ข์ ํดํน์ด ๋ ์ด๋ธ๋ก๋ ์
๋ ฅ์ด ๊ฒฝ์ฐ ์ค๋ฅด์ง๋์๋ค๋์ง ์์ ํ๋๊ฐ ๋น์ด ์์).
ํธ์ ๋ด์ ๊ฐ๊ธฐ
๋ถํํ๋ ์ด์ ์ฌ์ํ ์๋ก์ด ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์๋ ์์ฑ์ผ๋ก ์ฌ์ํ ๋. ์ฌ์ฉ์๋ฅผ ์ ํํ ๋ค์ ์ํธ๋ฅผ ์ญ์ ํ ๋ค์ ํ๋๊ฐ ๋น์ด ์์ด๋ ๋ ์ด๋ธ์ด ๊ณ์ ์ฌ๋ผ๊ฐ ์ํ๋ก ๋ค์ ์ ํํด๋ณด์ญ์์ค.
->
ํฌ๋กฌ : 77
Ubuntu : 18.04
@oliviertassinari @ eps1lon @croraf ๋๋ ๋ํ ๋ฌธ์ ๊ฐ ๋ ์ด์ ์กด์ฌํ์ง ์๋ ๋ด ์์ฉ ํ๋ก๊ทธ๋จ์์ ํ ์คํธํ์ต๋๋ค. ๋น์ ์ ๋์์ ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
@garygrubb ์์ ๊ฒ์๋ฌผ์์ ์ธ๊ธ ํ ๋ฏธ๋ฌํ ์ค๋ฅ๊ฐ ์๋์ง ํ์ธํ์ญ์์ค.
@coraf ์ ๋ฐ์คํฌํฑ Chrome ๋ฒ์ 76.0.3809.132 (๊ณต์ ๋น๋) (64 ๋นํธ)์์ ๋์ผํ ๋ฌธ์ ๋ฅผ ์ฌํ ํ ์์์์ต๋๋ค. ๋ชจ๋ฐ์ผ ๋ฒ์ ๊ณผ ํ์ด์ด ํญ์ค๋ ๊ด์ฐฎ์ ๋ณด์
๋๋ค.
์ด ๋ฌธ์ ์ ๋ํ ์๋ก์ด ๋ฌธ์ ๋ฅผ ์ด๋ฉด ๋ฐ๋ผ๊ฐ ์ ์๋๋ก ๋๋ฅผ ํ๊ทธ ํด์ฃผ์ธ์.
๋ค์์ด ๋์์ด ๋ ๊น์?
diff --git a/packages/material-ui/src/InputBase/InputBase.js b/packages/material-ui/src/InputBase/InputBase.js
index 439e8afa7..f0ab8bb66 100644
--- a/packages/material-ui/src/InputBase/InputBase.js
+++ b/packages/material-ui/src/InputBase/InputBase.js
@@ -373,6 +373,12 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
}
const handleAutoFill = () => {
+ // The change event is correcty triggered when the input is focused.
+ // There is no need to detect autofill.
+ if (fcs.focused) {
+ return;
+ }
+
// Provide a fake value as Chrome might not let you access it for security reasons.
checkDirty({ value: 'x' });
};
@oliviertassinari ์ข์์, mui ๋ฌธ์ ํ์ด์ง์์ ๋๋จธ์ง ๋ฌธ์ ๋ฅผ ์ผ๊ด๋๊ฒ ์ฌํํ์ต๋๋ค.
์ฐธ๊ณ :์ด ๋๋จธ์ง ๋ฌธ์ ๋ ์๋ ๋ฌธ์ ์ ๋น๊ตํ ๋ ๋งค์ฐ ์ฌ์ํ ๋ฌธ์ ์ด๋ฉฐ ์๋ง๋ ๊ทธ๋ค์ง ๋์ง ์์ ๊ฒ์
๋๋ค.
http : // localhost : 3000 / components / text-fields # outlined ์๋ก ๊ณ ์นจ
๋๋ ๋ค์๊ณผ ๊ฐ์ ๊ฒ์ ์ป๋๋ค.
์ด๋ฉ์ผ ํ๋๋ฅผ ์๋์ผ๋ก ์ญ์ ํ์ง๋ง ๋น๋ฐ๋ฒํธ๋ ์ฌ์ ํ ์๋์ผ๋ก ์ฑ์์ง๋๋ค.
localhost:3000
)์ ์ ์ฅ๋ ์ฌ์ฉ์๊ฐ์๋ ๋๋กญ ๋ค์ด์ ํ์ํฉ๋๋ค.์ด ์ํฉ์ด ๋ฐ์ํฉ๋๋ค.
@oliviertassinari ๊ทํ์ ์ถ๊ฐ ์์ ์ ์ ๊ฐ ์ค๋ช ํ ๋๋จธ์ง ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๊ทธ๋ฌ๋ ๋๋ ๋ฌธ์ ์ ๋ ๋ค๋ฅธ ๋ง์ ๋ฐ๊ฒฌํ์ต๋๋ค : D
๋ณต์ ๋จ๊ณ๋ ์์ ๋น์ทํ์ง๋ง 3 ๋จ๊ณ์์ ์๋์ผ๋ก ์ํธ๋ฅผ ์ง ์๋๋ค.
์ด๊ฒ์ ๋ง์ง๋ง์ ๋ค์๊ณผ ๊ฐ์ ๊ฒฐ๊ณผ ๋ฌธ์ ๋ฅผ ์ ๊ณตํฉ๋๋ค.
์ด๊ฒ์ ๋ง์ง๋ง์ ๋ค์๊ณผ ๊ฐ์ ๊ฒฐ๊ณผ ๋ฌธ์ ๋ฅผ ์ ๊ณตํฉ๋๋ค.
@croraf ์ค ์ด๋ฐ, ๋๋ ์ด๊ฒ์ด ์ค๋ ๊ฒ์ ๋ณด์ง ๋ชปํ์ต๋๋ค! ๋ค, ๋ง์ด ๋๋ค์.
diff --git a/packages/material-ui/src/InputBase/InputBase.js b/packages/material-ui/src/InputBase/InputBase.js
index 763ab105c..9dce66f9d 100644
--- a/packages/material-ui/src/InputBase/InputBase.js
+++ b/packages/material-ui/src/InputBase/InputBase.js
@@ -86,6 +86,7 @@ export const styles = theme => {
// Make the flex item shrink with Firefox
minWidth: 0,
width: '100%', // Fix IE 11 width issue
+ animationName: '$auto-fill-cancel',
'&::-webkit-input-placeholder': placeholder,
'&::-moz-placeholder': placeholder, // Firefox 19+
'&:-ms-input-placeholder': placeholder, // IE 11
@@ -123,6 +124,9 @@ export const styles = theme => {
'<strong i="9">@keyframes</strong> auto-fill': {
from: {},
},
+ '<strong i="10">@keyframes</strong> auto-fill-cancel': {
+ from: {},
+ },
/* Styles applied to the `input` element if `margin="dense"`. */
inputMarginDense: {
paddingTop: 4 - 1,
@@ -380,9 +384,11 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
};
}
- const handleAutoFill = () => {
+ const handleAutoFill = event => {
// Provide a fake value as Chrome might not let you access it for security reasons.
- checkDirty({ value: 'x' });
+ checkDirty(
+ event.animationName.indexOf('auto-fill-cancel') !== -1 ? inputRef.current : { value: 'x' },
+ );
};
return (
์์:
4.4.2
4.4.3
์ ์ ๋ ํจ์น
@oliviertassinari , @croraf- ํ๋ก๋์
์์ ํ
์คํธ๋์์ผ๋ฉฐ ์์๋๋ก ์๋ํฉ๋๋ค. ๊ฐ์ฌ.
๋ด๊ฐ ํ
์คํธํ๊ธฐ๋ฅผ ์ํ๋ ๋ค๋ฅธ ๋ฒ๊ทธ ์์ ์ ๋๋ฅผ ํ๊ทธ ํด์ฃผ์ธ์. ๊ธฐ๊บผ์ด ๋์ ๋๋ฆฌ๊ฒ ์ต๋๋ค.
๊ทธ๊ฒ์ ๋ฃ๊ณ ํ๋ณตํฉ๋๋ค.
์ด๋์ด ํ ๋ง๋ฅผ ์ง์ํ์ง ์์ต๋๊น?
@MAkerboom ์์์ ๋ ์งํ ํ๋์์ผ๋ก ๋ณ๊ฒฝํ๋ ๊ฒ์ ๊ณ ๋ คํ ์ ์์ต๋๋ค. ์คํ ํด๋ณด๊ณ ์ถ์ ๊ฒ์ด ์์ต๋๊น?
@oliviertassinari ์ค๊ณฝ์ ์ด ํ์๋๊ณ ์ฌ์ ํ ํ ์คํธ์ ์ถฉ๋ถํ ๋๋น๊ฐ์๋ ํ ๊ด์ฐฎ์ ๋ณด์ ๋๋ค.
@MAkerboom ๋ด๊ฐ ์๊ฐ
diff --git a/packages/material-ui/src/FilledInput/FilledInput.js b/packages/material-ui/src/FilledInput/FilledInput.js
index 71d0bcc94..4b681cba1 100644
--- a/packages/material-ui/src/FilledInput/FilledInput.js
+++ b/packages/material-ui/src/FilledInput/FilledInput.js
@@ -106,6 +106,12 @@ export const styles = theme => {
/* Styles applied to the `input` element. */
input: {
padding: '27px 12px 10px',
+ '&:-webkit-autofill': {
+ WebkitBoxShadow: theme.palette.type === 'dark' ? '0 0 0 100px #266798 inset' : null,
+ WebkitTextFillColor: theme.palette.type === 'dark' ? '#fff' : null,
+ borderTopLeftRadius: 'inherit',
+ borderTopRightRadius: 'inherit',
+ },
},
/* Styles applied to the `input` element if `margin="dense"`. */
inputMarginDense: {
diff --git a/packages/material-ui/src/OutlinedInput/OutlinedInput.js b/packages/material-ui/src/OutlinedInput/OutlinedInput.js
index f60c4e5d5..376e37ba8 100644
--- a/packages/material-ui/src/OutlinedInput/OutlinedInput.js
+++ b/packages/material-ui/src/OutlinedInput/OutlinedInput.js
@@ -65,6 +65,11 @@ export const styles = theme => {
/* Styles applied to the `input` element. */
input: {
padding: '18.5px 14px',
+ '&:-webkit-autofill': {
+ WebkitBoxShadow: theme.palette.type === 'dark' ? '0 0 0 100px #266798 inset' : null,
+ WebkitTextFillColor: theme.palette.type === 'dark' ? '#fff' : null,
+ borderRadius: theme.shape.borderRadius,
+ },
},
/* Styles applied to the `input` element if `margin="dense"`. */
inputMarginDense: {
๋๋ ๊ทธ๋ ๊ฒํ๋ ๊ฒ์ด ๊ด์ฐฎ ๋? ํ ์์ฒญ์ ์ ์ถ ํ์๊ฒ ์ต๋๊น? :)
ํจ์ฌ ๋ซ๋ค! ๊ณ ๋ง์. PR์ ์๋ํฉ๋๋ค
<AutoComplete/>
๋ฅผ ์ฌ์ฉํ๋ ๋์์ด ๋ฒ๊ทธ๋ฅผ ๋ณด์์ต๋๋ค. ํ
์คํธ ํ๋์ ์ด์ ์ ๋ง์ถ ๋ ๋ ์ด๋ธ์ด "์ถ์"๋์ง ์์ต๋๋ค. Firefox์ Chrome์์ ์ด๊ฒ์ ๋ณด์์ต๋๋ค (๋ค๋ฅธ ๋ธ๋ผ์ฐ์ ๋ ํ
์คํธํ์ง ์์์ต๋๋ค). v4.5.0์์ v4.5.2๋ก ์
๊ทธ๋ ์ด๋ํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค. ์ด ๋ฌธ์ ์ ๊ด๋ จ๋ PR์ด ์ฑ
์์ด ์๋ค๊ณ ์๊ฐํ๋ฏ๋ก ๊ฐ์ฌํฉ๋๋ค!
FWIW๋ ํฌ๋กฌ์ด ์๋์ผ๋ก ์ฑ์์ง ์ ๋ ฅ์ ์ฌ์ฉ์ ์ ์ ์์์ ํ์ํ์ง ์๋๋กํ๋ ํ ๋ง ์ฌ์ ์์ ๋๋ค.
theme = {
overrides: {
MuiInputBase: {
root: {
fontFamily: '"Lato", serif',
"& input": {
"&:-webkit-autofill": {
transition:
"background-color 50000s ease-in-out 0s, color 50000s ease-in-out 0s",
},
"&:-webkit-autofill:focus": {
transition:
"background-color 50000s ease-in-out 0s, color 50000s ease-in-out 0s",
},
"&:-webkit-autofill:hover": {
transition:
"background-color 50000s ease-in-out 0s, color 50000s ease-in-out 0s",
},
},
},
},
}
}
@armellarcier ๊ณต์ ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. ์ฌ์ฉ์ ์ ์ ์์์ ์ ๊ฑฐํ๋ ๋ฐ์ฃผ์๋ฅผ ๊ธฐ์ธ์ด๊ณ , ์ฌ์ฉ์๋ฅผ ๋๊ธฐ์ํ ๊ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. ๋ํ ๋ณด์ ๊ด์ ์์ ํฅ๋ฏธ๋ก์ธ ์ ์์ต๋๋ค. ์ฌ๋ฐ๋ฅธ ๋๋ฉ์ธ ์ด๋ฆ์ ์ฌ์ฉํ๊ณ ์๋์ง ๋ ์ ์ ์ ์์ต๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ์๋ ์์ฑ์ด ์๋ํ์ง ์์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
@garygrubb ํ ๋ง ์ฌ์ ์๋ฅผ ํตํด์ด ์์ ์ ์ํํ์ต๋๋ค.
์ด์์ ์ด์ง๋ ์์ง๋ง ๋ฌด์ธ๊ฐ์ ๋๋ค.
๋์์ ์์ ๊ทธ๋ฆผ์๋ฅผ ์ฌ์ฉํ์ฌ ์ ๋ ฅ์ ์ฑ์ฐ๋ ๊ฒ์ ๋๋ค : https://stackoverflow.com/questions/2781549/removing-input-background-colour-for-chrome-autocomplete