// 2. Change the default font family in all browsers.
// 3. Correct the line height in all browsers.
// 4. Prevent adjustments of font size after orientation changes in IE on Windows Phone and in iOS.
-// 5. Setting @viewport causes scrollbars to overlap content in IE11 and Edge, so
-// we force a non-overlapping, non-auto-hiding scrollbar to counteract.
-// 6. Change the default tap highlight to be completely transparent in iOS.
+// 5. Change the default tap highlight to be completely transparent in iOS.
*,
*::before,
font-family: sans-serif; // 2
line-height: 1.15; // 3
-webkit-text-size-adjust: 100%; // 4
- -ms-overflow-style: scrollbar; // 5
- -webkit-tap-highlight-color: rgba($black, 0); // 6
-}
-
-// IE10+ doesn't honor `<meta name="viewport">` in some cases.
-@at-root {
- @-ms-viewport {
- width: device-width;
- }
+ -webkit-tap-highlight-color: rgba($black, 0); // 5
}
// Shim for "new" HTML5 structural elements to display correctly (IE10, older browsers)
//
// 1. Remove the margin in all browsers.
// 2. As a best practice, apply a default `background-color`.
-// 3. Set an explicit initial text-align value so that we can later use the
+// 3. Set an explicit initial text-align value so that we can later use
// the `inherit` value on things like `<th>` elements.
body {
margin: 0; // 1
font-family: $font-family-base;
- font-size: $font-size-base;
+ @include font-size($font-size-base);
font-weight: $font-weight-base;
line-height: $line-height-base;
color: $body-color;
background-color: $body-bg; // 2
}
-// Suppress the focus outline on elements that cannot be accessed via keyboard.
-// This prevents an unwanted focus outline from appearing around elements that
-// might still respond to pointer events.
+// Future-proof rule: in browsers that support :focus-visible, suppress the focus outline
+// on elements that programmatically receive focus but wouldn't normally show a visible
+// focus outline. In general, this would mean that the outline is only applied if the
+// interaction that led to the element receiving programmatic focus was a keyboard interaction,
+// or the browser has somehow determined that the user is primarily a keyboard user and/or
+// wants focus outlines to always be presented.
//
-// Credit: https://github.com/suitcss/base
-[tabindex="-1"]:focus {
+// See https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible
+// and https://developer.paciellogroup.com/blog/2018/03/focus-visible-and-backwards-compatibility/
+[tabindex="-1"]:focus:not(:focus-visible) {
outline: 0 !important;
}
b,
strong {
- font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari
+ font-weight: $font-weight-bolder; // Add the correct font weight in Chrome, Edge, and Safari
}
small {
- font-size: 80%; // Add the correct font size in all browsers
+ @include font-size(80%); // Add the correct font size in all browsers
}
//
sub,
sup {
position: relative;
- font-size: 75%;
+ @include font-size(75%);
line-height: 0;
vertical-align: baseline;
}
text-decoration: $link-decoration;
background-color: transparent; // Remove the gray background on active links in IE 10.
- @include hover {
+ @include hover() {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
}
}
-// And undo these styles for placeholder links/named anchors (without href)
-// which have not been made explicitly keyboard-focusable (without tabindex).
+// And undo these styles for placeholder links/named anchors (without href).
// It would be more straightforward to just use a[href] in previous block, but that
// causes specificity issues in many other styles that are too complex to fix.
// See https://github.com/twbs/bootstrap/issues/19402
-a:not([href]):not([tabindex]) {
+a:not([href]):not([class]) {
color: inherit;
text-decoration: none;
- @include hover-focus {
+ @include hover() {
color: inherit;
text-decoration: none;
}
-
- &:focus {
- outline: 0;
- }
}
kbd,
samp {
font-family: $font-family-monospace;
- font-size: 1em; // Correct the odd `em` font sizing in all browsers.
+ @include font-size(1em); // Correct the odd `em` font sizing in all browsers.
}
pre {
margin-bottom: 1rem;
// Don't allow content to break outside
overflow: auto;
- // We have @viewport set which causes scrollbars to overlap content in IE11 and Edge, so
- // we force a non-overlapping, non-auto-hiding scrollbar to counteract.
+ // Disable auto-hiding scrollbar in IE & legacy Edge to avoid overlap,
+ // making it impossible to interact with the content
-ms-overflow-style: scrollbar;
}
caption-side: bottom;
}
+// 1. Removes font-weight bold by inheriting
+// 2. Matches default `<td>` alignment by inheriting `text-align`.
+// 3. Fix alignment for Safari
+
th {
- // Matches default `<td>` alignment by inheriting from the `<body>`, or the
- // closest parent with a set `text-align`.
- text-align: inherit;
+ font-weight: $table-th-font-weight; // 1
+ text-align: inherit; // 2
+ text-align: -webkit-match-parent; // 3
}
//
// Details at https://github.com/twbs/bootstrap/issues/24093
button {
+ // stylelint-disable-next-line property-disallowed-list
border-radius: 0;
}
textarea {
margin: 0; // Remove the margin in Firefox and Safari
font-family: inherit;
- font-size: inherit;
+ @include font-size(inherit);
line-height: inherit;
}
text-transform: none; // Remove the inheritance of text transform in Firefox
}
+// Set the cursor for non-`<button>` buttons
+//
+// Details at https://github.com/twbs/bootstrap/pull/30562
+[role="button"] {
+ cursor: pointer;
+}
+
+// Remove the inheritance of word-wrap in Safari.
+//
+// Details at https://github.com/twbs/bootstrap/issues/24990
+select {
+ word-wrap: normal;
+}
+
+
// 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
// controls in Android 4.
// 2. Correct the inability to style clickable types in iOS and Safari.
-webkit-appearance: button; // 2
}
+// Opinionated: add "hand" cursor to non-disabled button elements.
+@if $enable-pointer-cursor-for-buttons {
+ button,
+ [type="button"],
+ [type="reset"],
+ [type="submit"] {
+ &:not(:disabled) {
+ cursor: pointer;
+ }
+ }
+}
+
// Remove inner border and padding from Firefox, but don't restore the outline like Normalize.
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
}
-input[type="date"],
-input[type="time"],
-input[type="datetime-local"],
-input[type="month"] {
- // 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
- -webkit-appearance: listbox;
-}
-
textarea {
overflow: auto; // Remove the default vertical scrollbar in IE.
// Textareas should really only resize vertically so they don't break their (horizontal) containers.
max-width: 100%; // 1
padding: 0;
margin-bottom: .5rem;
- font-size: 1.5rem;
+ @include font-size(1.5rem);
line-height: inherit;
color: inherit; // 2
white-space: normal; // 1
}
//
-// Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
+// Remove the inner padding in Chrome and Safari on macOS.
//
[type="search"]::-webkit-search-decoration {