From 1369b81492a5368ac40dbfac3d6553e32065f706 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 18 Jan 2023 06:09:39 +0100 Subject: [PATCH] Fix Android Chrome input date dimensions (#36143) * Bind Hugo to 0.0.0.0, helps debug on mobile when on the same network * Use http-server for visual tests * Add input visual tests * Fix input date dimensions on Android Chrome * Increase bootstrap.css max size * Revert "Bind Hugo to 0.0.0.0" & "Use http-server for visual tests" * Switch to pixels: this is an empirical minimum safe value * Update .bundlewatch.config.json Co-authored-by: Mark Otto --- .bundlewatch.config.json | 4 +- js/tests/visual/input.html | 79 +++++++++++++++++++++++++++++++++++ scss/forms/_form-control.scss | 18 ++++++-- 3 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 js/tests/visual/input.html diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index c9aac7e60e..a594451ea2 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -26,7 +26,7 @@ }, { "path": "./dist/css/bootstrap.css", - "maxSize": "32.25 kB" + "maxSize": "32.5 kB" }, { "path": "./dist/css/bootstrap.min.css", @@ -63,4 +63,4 @@ "v4-dev" ] } -} \ No newline at end of file +} diff --git a/js/tests/visual/input.html b/js/tests/visual/input.html new file mode 100644 index 0000000000..6ef08d9aa5 --- /dev/null +++ b/js/tests/visual/input.html @@ -0,0 +1,79 @@ + + + + + + + Form + + + +
+

Input Bootstrap Visual Test

+ +

No layout

+ +
+ Text + +
+
+ Email + +
+
+ Number + +
+
+ Date + +
+ +

Flex

+ +
+
+ Text + +
+
+ Email + +
+
+ Number + +
+
+ Date + +
+
+ +

Grid

+ +
+
+ Text + +
+
+ Email + +
+
+ Number + +
+
+ Date + +
+
+
+ + + + + diff --git a/scss/forms/_form-control.scss b/scss/forms/_form-control.scss index c81e3b4ea0..ab72654d3d 100644 --- a/scss/forms/_form-control.scss +++ b/scss/forms/_form-control.scss @@ -44,12 +44,24 @@ } } - // Add some height to date inputs on iOS - // https://github.com/twbs/bootstrap/issues/23307 - // TODO: we can remove this workaround once https://bugs.webkit.org/show_bug.cgi?id=198959 is resolved &::-webkit-date-and-time-value { + // On Android Chrome, form-control's "width: 100%" makes the input width too small + // Tested under Android 11 / Chrome 89, Android 12 / Chrome 100, Android 13 / Chrome 109 + // + // On iOS Safari, form-control's "appearance: none" + "width: 100%" makes the input width too small + // Tested under iOS 16.2 / Safari 16.2 + min-width: 85px; // Seems to be a good minimum safe width + + // Add some height to date inputs on iOS + // https://github.com/twbs/bootstrap/issues/23307 + // TODO: we can remove this workaround once https://bugs.webkit.org/show_bug.cgi?id=198959 is resolved // Multiply line-height by 1em if it has no unit height: if(unit($input-line-height) == "", $input-line-height * 1em, $input-line-height); + + // Android Chrome type="date" is taller than the other inputs + // because of "margin: 1px 24px 1px 4px" inside the shadow DOM + // Tested under Android 11 / Chrome 89, Android 12 / Chrome 100, Android 13 / Chrome 109 + margin: 0; } // Prevent excessive date input height in Webkit