Skip to content

Commit

Permalink
Fix date inputs heights in safari
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnCuppens committed Mar 10, 2020
1 parent d79830c commit 62acca4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
13 changes: 0 additions & 13 deletions scss/_reboot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -474,19 +474,6 @@ button,
border-style: none;
}

// Remove the default appearance of temporal inputs to avoid a Mobile Safari
// bug where setting a custom line-height prevents text from being vertically
// centered within the input.
// See https://bugs.webkit.org/show_bug.cgi?id=139848
// and https://github.com/twbs/bootstrap/issues/11266

input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
-webkit-appearance: textfield;
}

// 1. Remove the default vertical scrollbar in IE.
// 2. Textareas should really only resize vertically so they don't break their (horizontal) containers.

Expand Down
6 changes: 6 additions & 0 deletions scss/forms/_form-control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
background-color: $input-bg;
background-clip: padding-box;
border: $input-border-width solid $input-border-color;
appearance: none; // Fix appearance for date inputs in Safari

// Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
@include border-radius($input-border-radius, 0);
Expand All @@ -28,6 +29,11 @@
border: 0;
}

// Set the height of date inputs in Safari
&::-webkit-date-and-time-value {
height: if(unitless($input-line-height), $input-line-height * 1em, $input-line-height);
}

// Customize the `:focus` state to imitate native WebKit styles.
&:focus {
color: $input-focus-color;
Expand Down

0 comments on commit 62acca4

Please sign in to comment.