]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fix Android Chrome input date dimensions (#36143)
authorTanguy Krotoff <tkrotoff@gmail.com>
Wed, 18 Jan 2023 05:09:39 +0000 (06:09 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Jan 2023 05:09:39 +0000 (21:09 -0800)
* 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 <otto@github.com>
.bundlewatch.config.json
js/tests/visual/input.html [new file with mode: 0644]
scss/forms/_form-control.scss

index c9aac7e60e0766c949176f1738efd4f98691863c..a594451ea24cb1fe794b7bc60145c6bb64d1504c 100644 (file)
@@ -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 (file)
index 0000000..6ef08d9
--- /dev/null
@@ -0,0 +1,79 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <link href="../../../dist/css/bootstrap.min.css" rel="stylesheet">
+    <title>Form</title>
+    <style></style>
+  </head>
+  <body>
+    <div class="container">
+      <h1>Input <small>Bootstrap Visual Test</small></h1>
+
+      <h2>No layout</h2>
+
+      <div class="mb-3">
+        Text
+        <input class="form-control">
+      </div>
+      <div class="mb-3">
+        Email
+        <input type="email" class="form-control">
+      </div>
+      <div class="mb-3">
+        Number
+        <input type="number" class="form-control">
+      </div>
+      <div class="mb-3">
+        Date
+        <input type="date" class="form-control">
+      </div>
+
+      <h2>Flex</h2>
+
+      <div class="d-flex flex-wrap gap-3 mb-3">
+        <div>
+          Text
+          <input class="form-control">
+        </div>
+        <div>
+          Email
+          <input type="email" class="form-control">
+        </div>
+        <div>
+          Number
+          <input type="number" class="form-control">
+        </div>
+        <div>
+          Date
+          <input type="date" class="form-control">
+        </div>
+      </div>
+
+      <h2>Grid</h2>
+
+      <div class="row mb-3">
+        <div class="col">
+          Text
+          <input class="form-control">
+        </div>
+        <div class="col">
+          Email
+          <input type="email" class="form-control">
+        </div>
+        <div class="col">
+          Number
+          <input type="number" class="form-control">
+        </div>
+        <div class="col">
+          Date
+          <input type="date" class="form-control">
+        </div>
+      </div>
+    </div>
+
+    <script src="../../../dist/js/bootstrap.bundle.js"></script>
+    <script></script>
+  </body>
+</html>
index c81e3b4ea02b64dd6dedbee27f587173266f7b3e..ab72654d3d40daa8ceeea3497b51072e1faf0510 100644 (file)
     }
   }
 
-  // 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