From 03aadc515f96e1f6e1ededa1288ae4273f4236e1 Mon Sep 17 00:00:00 2001 From: unix Date: Sun, 26 Apr 2020 22:23:57 +0800 Subject: [PATCH 1/4] fix(styles): remove background of webkit autofill --- components/input/input.tsx | 7 +++++++ components/styles/css-baseline/css-baseline.tsx | 12 ++++++------ components/textarea/textarea.tsx | 7 +++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/components/input/input.tsx b/components/input/input.tsx index 74bf0b6..378cb48 100644 --- a/components/input/input.tsx +++ b/components/input/input.tsx @@ -215,6 +215,13 @@ const Input: React.FC> = ({ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: ${theme.palette.accents_3}; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px ${theme.palette.background} inset !important; + } `} ) diff --git a/components/styles/css-baseline/css-baseline.tsx b/components/styles/css-baseline/css-baseline.tsx index 69991e3..3b9fd1a 100644 --- a/components/styles/css-baseline/css-baseline.tsx +++ b/components/styles/css-baseline/css-baseline.tsx @@ -31,9 +31,14 @@ const CSSBaseline: React.FC> = React.memo(({ padding: 0; min-height: 100%; position: relative; + overflow-x: hidden; font-family: ${theme.font.sans}; } + #__next { + overflow-x: hidden; + } + *, *:before, *:after { box-sizing: inherit; text-rendering: geometricPrecision; @@ -114,7 +119,6 @@ const CSSBaseline: React.FC> = React.memo(({ } h1, h2, h3, h4, h5, h6 { - font-family: ${theme.font.sans}; color: inherit; margin: 0 0 .625rem 0; } @@ -156,10 +160,6 @@ const CSSBaseline: React.FC> = React.memo(({ font-weight: 600; } - input-webkit-autofill { - box-shadow: 0 0 0 100px var(--geist-background) inset; - } - button, input, select, textarea { font-family: inherit; font-size: inherit; @@ -167,7 +167,7 @@ const CSSBaseline: React.FC> = React.memo(({ color: inherit; margin: 0; } - + button:focus, input:focus, select:focus, textarea:focus { outline: none; } diff --git a/components/textarea/textarea.tsx b/components/textarea/textarea.tsx index 50adb74..516cacc 100644 --- a/components/textarea/textarea.tsx +++ b/components/textarea/textarea.tsx @@ -115,6 +115,13 @@ const Textarea: React.FC> = ({ .disabled > textarea { cursor: not-allowed; } + + textarea:-webkit-autofill, + textarea:-webkit-autofill:hover, + textarea:-webkit-autofill:active, + textarea:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px ${theme.palette.background} inset !important; + } `} ) From 54bbd622b945d972d1b06f5473428789bc198ab7 Mon Sep 17 00:00:00 2001 From: unix Date: Sun, 26 Apr 2020 22:25:55 +0800 Subject: [PATCH 2/4] fix(baseline): fix default font-size for element small --- components/styles/css-baseline/css-baseline.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/styles/css-baseline/css-baseline.tsx b/components/styles/css-baseline/css-baseline.tsx index 3b9fd1a..5c44a56 100644 --- a/components/styles/css-baseline/css-baseline.tsx +++ b/components/styles/css-baseline/css-baseline.tsx @@ -61,7 +61,7 @@ const CSSBaseline: React.FC> = React.memo(({ small { margin: 0; line-height: 1.5; - font-size: 14px; + font-size: .875rem; } b { From 2ce0b33d6404cd3318aecc5cb5d8bf51d0199c7a Mon Sep 17 00:00:00 2001 From: unix Date: Sun, 26 Apr 2020 22:26:44 +0800 Subject: [PATCH 3/4] chore: remove unused --- pages/_app.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pages/_app.tsx b/pages/_app.tsx index 57f85a7..ca92d56 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -88,10 +88,6 @@ const Application: NextPage> = ({ Component, pageProps }) => { color: ${theme.palette.accents_3}; } - body { - overflow-x: hidden; - } - body::-webkit-scrollbar { width: 0; background-color: ${theme.palette.accents_1}; From a0aa11ef1d3b2f34c451c91de551c0d30807a997 Mon Sep 17 00:00:00 2001 From: unix Date: Sun, 26 Apr 2020 22:33:15 +0800 Subject: [PATCH 4/4] test: update snapshots --- .../__snapshots__/search.test.tsx.snap | 56 +++++++++++++ .../__snapshots__/index.test.tsx.snap | 84 +++++++++++++++++++ .../__snapshots__/baseline.test.tsx.snap | 28 +++---- .../__snapshots__/index.test.tsx.snap | 28 +++++++ 4 files changed, 182 insertions(+), 14 deletions(-) diff --git a/components/auto-complete/__tests__/__snapshots__/search.test.tsx.snap b/components/auto-complete/__tests__/__snapshots__/search.test.tsx.snap index 5d37363..73f5015 100644 --- a/components/auto-complete/__tests__/__snapshots__/search.test.tsx.snap +++ b/components/auto-complete/__tests__/__snapshots__/search.test.tsx.snap @@ -149,6 +149,13 @@ initialize { ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } ", "next": null, "parent": [Circular], @@ -255,6 +262,13 @@ initialize { ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } ", "next": null, "parent": [Circular], @@ -548,6 +562,13 @@ initialize { ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } ", "next": null, "parent": [Circular], @@ -654,6 +675,13 @@ initialize { ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } ", "next": null, "parent": [Circular], @@ -943,6 +971,13 @@ initialize { ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } ", "next": null, "parent": [Circular], @@ -1049,6 +1084,13 @@ initialize { ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } ", "next": null, "parent": [Circular], @@ -1342,6 +1384,13 @@ initialize { ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } ", "next": null, "parent": [Circular], @@ -1448,6 +1497,13 @@ initialize { ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } ", "next": null, "parent": [Circular], diff --git a/components/input/__tests__/__snapshots__/index.test.tsx.snap b/components/input/__tests__/__snapshots__/index.test.tsx.snap index 9c907be..31c9a2b 100644 --- a/components/input/__tests__/__snapshots__/index.test.tsx.snap +++ b/components/input/__tests__/__snapshots__/index.test.tsx.snap @@ -91,6 +91,13 @@ exports[`Input should be work with icon 1`] = ` ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + }
test-icon
" `; @@ -289,6 +303,13 @@ exports[`Input should be work with label 1`] = ` ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + }
label
" `; @@ -567,6 +602,13 @@ exports[`Input should work with different sizes 1`] = ` ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + }
" `; @@ -875,6 +938,13 @@ exports[`Input should work with different status 1`] = ` ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder { color: #999; } + + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:active, + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + }
" `; diff --git a/components/styles/__tests__/__snapshots__/baseline.test.tsx.snap b/components/styles/__tests__/__snapshots__/baseline.test.tsx.snap index 095d16e..7bb6c7b 100644 --- a/components/styles/__tests__/__snapshots__/baseline.test.tsx.snap +++ b/components/styles/__tests__/__snapshots__/baseline.test.tsx.snap @@ -26,9 +26,14 @@ initialize { padding: 0; min-height: 100%; position: relative; + overflow-x: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; } + #__next { + overflow-x: hidden; + } + *, *:before, *:after { box-sizing: inherit; text-rendering: geometricPrecision; @@ -51,7 +56,7 @@ initialize { small { margin: 0; line-height: 1.5; - font-size: 14px; + font-size: .875rem; } b { @@ -109,7 +114,6 @@ initialize { } h1, h2, h3, h4, h5, h6 { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; color: inherit; margin: 0 0 .625rem 0; } @@ -151,10 +155,6 @@ initialize { font-weight: 600; } - input-webkit-autofill { - box-shadow: 0 0 0 100px var(--geist-background) inset; - } - button, input, select, textarea { font-family: inherit; font-size: inherit; @@ -162,7 +162,7 @@ initialize { color: inherit; margin: 0; } - + button:focus, input:focus, select:focus, textarea:focus { outline: none; } @@ -318,9 +318,14 @@ initialize { padding: 0; min-height: 100%; position: relative; + overflow-x: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; } + #__next { + overflow-x: hidden; + } + *, *:before, *:after { box-sizing: inherit; text-rendering: geometricPrecision; @@ -343,7 +348,7 @@ initialize { small { margin: 0; line-height: 1.5; - font-size: 14px; + font-size: .875rem; } b { @@ -401,7 +406,6 @@ initialize { } h1, h2, h3, h4, h5, h6 { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; color: inherit; margin: 0 0 .625rem 0; } @@ -443,10 +447,6 @@ initialize { font-weight: 600; } - input-webkit-autofill { - box-shadow: 0 0 0 100px var(--geist-background) inset; - } - button, input, select, textarea { font-family: inherit; font-size: inherit; @@ -454,7 +454,7 @@ initialize { color: inherit; margin: 0; } - + button:focus, input:focus, select:focus, textarea:focus { outline: none; } diff --git a/components/textarea/__tests__/__snapshots__/index.test.tsx.snap b/components/textarea/__tests__/__snapshots__/index.test.tsx.snap index e08c951..f931373 100644 --- a/components/textarea/__tests__/__snapshots__/index.test.tsx.snap +++ b/components/textarea/__tests__/__snapshots__/index.test.tsx.snap @@ -44,6 +44,13 @@ exports[`Textarea should render correctly 1`] = ` .disabled > textarea { cursor: not-allowed; } + + textarea:-webkit-autofill, + textarea:-webkit-autofill:hover, + textarea:-webkit-autofill:active, + textarea:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + } " `; @@ -91,6 +98,13 @@ exports[`Textarea should work with different styles 1`] = ` .disabled > textarea { cursor: not-allowed; } + + textarea:-webkit-autofill, + textarea:-webkit-autofill:hover, + textarea:-webkit-autofill:active, + textarea:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 30px #fff inset !important; + }
" `;