diff --git a/scss/_settings.scss b/scss/_settings.scss index 07cc20f2..9b435d53 100644 --- a/scss/_settings.scss +++ b/scss/_settings.scss @@ -38,6 +38,11 @@ $enable-transitions: true !default; // Enable overriding with !important $enable-important: true !default; +// Optional parent selector +// If defined, all HTML tags are wrapped with this selector +// :root is not wrapped +$parent-selector: "" !default; + // Breakpoints, viewports and root font size $breakpoints: () !default; $breakpoints: map.deep-merge( diff --git a/scss/components/_accordion.scss b/scss/components/_accordion.scss index 8a4c5dca..3ffabb80 100644 --- a/scss/components/_accordion.scss +++ b/scss/components/_accordion.scss @@ -6,7 +6,7 @@ * Accordion (
) */ - details { + #{$parent-selector} details { display: block; margin-bottom: var(#{$css-var-prefix}spacing); @@ -102,7 +102,7 @@ } [dir="rtl"] { - details { + #{$parent-selector} details { summary { text-align: right; diff --git a/scss/components/_card.scss b/scss/components/_card.scss index dbd83842..19d8358f 100644 --- a/scss/components/_card.scss +++ b/scss/components/_card.scss @@ -6,7 +6,7 @@ * Card (
) */ - article { + #{$parent-selector} article { margin-bottom: var(#{$css-var-prefix}block-spacing-vertical); padding: var(#{$css-var-prefix}block-spacing-vertical) var(#{$css-var-prefix}block-spacing-horizontal); diff --git a/scss/components/_dropdown.scss b/scss/components/_dropdown.scss index ff2b6959..9304be9e 100644 --- a/scss/components/_dropdown.scss +++ b/scss/components/_dropdown.scss @@ -8,7 +8,7 @@ // Container // –––––––––––––––––––– - details.dropdown { + #{$parent-selector} details.dropdown { position: relative; border-bottom: none; @@ -38,7 +38,7 @@ // Container type accordion // inside a nav // –––––––––––––––––––– - nav details.dropdown { + #{$parent-selector} nav details.dropdown { // Override height margin-bottom: 0; } @@ -46,7 +46,7 @@ // Bouton as a select // inside container type accordion // –––––––––––––––––––– - details.dropdown summary:not([role]) { + #{$parent-selector} details.dropdown summary:not([role]) { height: calc( 1rem * var(#{$css-var-prefix}line-height) + @@ -122,7 +122,7 @@ // Dropdown inside a nav // –––––––––––––––––––– - nav details.dropdown { + #{$parent-selector} nav details.dropdown { display: inline; margin: calc(var(#{$css-var-prefix}nav-element-spacing-vertical) * -1) 0; @@ -146,7 +146,7 @@ // Submenu // –––––––––––––––––––– - details.dropdown summary + ul { + #{$parent-selector} details.dropdown summary + ul { display: flex; z-index: 99; position: absolute; @@ -226,14 +226,14 @@ // Button opened // inside container type accordion // –––––––––––––––––––– - details.dropdown[open] summary { + #{$parent-selector} details.dropdown[open] summary { margin-bottom: 0; } // Menu opened // –––––––––––––––––––– // 1. Inside container type accordion - details.dropdown[open] summary { + #{$parent-selector} details.dropdown[open] summary { + ul { transform: scaleY(1); opacity: 1; @@ -249,7 +249,7 @@ // Close for dropdown // inside container type accordion // –––––––––––––––––––– - details.dropdown[open] summary { + #{$parent-selector} details.dropdown[open] summary { &::before { display: block; z-index: 1; @@ -264,7 +264,7 @@ } // Label // –––––––––––––––––––– - label > details.dropdown { + #{$parent-selector} label > details.dropdown { margin-top: calc(var(#{$css-var-prefix}spacing) * 0.25); } } diff --git a/scss/components/_group.scss b/scss/components/_group.scss index a2ca2653..96666d69 100644 --- a/scss/components/_group.scss +++ b/scss/components/_group.scss @@ -6,14 +6,14 @@ * Group ([role="group"], [role="search"]) */ - form { + #{$parent-selector} form { &[role="search"], &[role="group"] { width: 100%; } } - [role="search"] { + #{$parent-selector} [role="search"] { > * { &:first-child { border-top-left-radius: 5rem; @@ -27,8 +27,8 @@ } } - [role="search"], - [role="group"] { + #{$parent-selector} [role="search"], + #{$parent-selector} [role="group"] { display: inline-flex; position: relative; margin-bottom: var(#{$css-var-prefix}spacing); diff --git a/scss/components/_loading.scss b/scss/components/_loading.scss index db12086b..aab9650f 100644 --- a/scss/components/_loading.scss +++ b/scss/components/_loading.scss @@ -7,7 +7,7 @@ */ // Everything except form elements - [aria-busy="true"]:not(input, select, textarea, html) { + #{$parent-selector} [aria-busy="true"]:not(input, select, textarea, html) { white-space: nowrap; &::before { @@ -33,12 +33,12 @@ } // Buttons and links - button, - [type="submit"], - [type="button"], - [type="reset"], - [role="button"], - a { + #{$parent-selector} button, + #{$parent-selector} [type="submit"], + #{$parent-selector} [type="button"], + #{$parent-selector} [type="reset"], + #{$parent-selector} [role="button"], + #{$parent-selector} a { &[aria-busy="true"] { pointer-events: none; } diff --git a/scss/components/_modal.scss b/scss/components/_modal.scss index 0160a286..e13c6227 100644 --- a/scss/components/_modal.scss +++ b/scss/components/_modal.scss @@ -10,7 +10,7 @@ #{$css-var-prefix}scrollbar-width: 0px; } - dialog { + #{$parent-selector} dialog { display: flex; z-index: 999; position: fixed; diff --git a/scss/components/_nav.scss b/scss/components/_nav.scss index 65f74afa..8690930a 100644 --- a/scss/components/_nav.scss +++ b/scss/components/_nav.scss @@ -18,12 +18,12 @@ // Pico // –––––––––––––––––––– - nav, - nav ul { + #{$parent-selector} nav, + #{$parent-selector} nav ul { display: flex; } - nav { + #{$parent-selector} nav { justify-content: space-between; ol, @@ -118,7 +118,7 @@ } // Vertical Nav - aside { + #{$parent-selector} aside { nav, ol, ul, @@ -143,7 +143,7 @@ // Breadcrumb RTL [dir="rtl"] { - nav { + #{$parent-selector} nav { &[aria-label="breadcrumb"] { & ul li { &:not(:last-child) { diff --git a/scss/components/_progress.scss b/scss/components/_progress.scss index 7729c250..576b8e46 100644 --- a/scss/components/_progress.scss +++ b/scss/components/_progress.scss @@ -13,7 +13,7 @@ // 1. Add the correct display in Edge 18- and IE // 2. Add the correct vertical alignment in Chrome, Edge, and Firefox - progress { + #{$parent-selector} progress { display: inline-block; // 1 vertical-align: baseline; // 2 } @@ -21,7 +21,7 @@ // Pico // –––––––––––––––––––– - progress { + #{$parent-selector} progress { // Reset the default appearance -webkit-appearance: none; -moz-appearance: none; @@ -84,7 +84,7 @@ [dir="rtl"] { @media (prefers-reduced-motion: no-preference) { - progress:indeterminate { + #{$parent-selector} progress:indeterminate { animation-direction: reverse; } } diff --git a/scss/components/_tooltip.scss b/scss/components/_tooltip.scss index 2e1a7ab2..2076438d 100644 --- a/scss/components/_tooltip.scss +++ b/scss/components/_tooltip.scss @@ -6,7 +6,7 @@ * Tooltip ([data-tooltip]) */ - [data-tooltip] { + #{$parent-selector} [data-tooltip] { position: relative; &:not(a, button, input) { diff --git a/scss/content/_button.scss b/scss/content/_button.scss index 8e6ee500..2887e7e9 100644 --- a/scss/content/_button.scss +++ b/scss/content/_button.scss @@ -14,7 +14,7 @@ // 1. Change the font styles in all browsers // 2. Remove the margin on controls in Safari // 3. Show the overflow in Edge - button { + #{$parent-selector} button { margin: 0; // 2 overflow: visible; // 3 font-family: inherit; // 1 @@ -22,22 +22,22 @@ } // Correct the inability to style buttons in iOS and Safari - button, - [type="submit"], - [type="reset"], - [type="button"] { + #{$parent-selector} button, + #{$parent-selector} [type="submit"], + #{$parent-selector} [type="reset"], + #{$parent-selector} [type="button"] { -webkit-appearance: button; } // Pico // –––––––––––––––––––– - button, - [type="submit"], - [type="reset"], - [type="button"], - [type="file"]::file-selector-button, - [role="button"] { + #{$parent-selector} button, + #{$parent-selector} [type="submit"], + #{$parent-selector} [type="reset"], + #{$parent-selector} [type="button"], + #{$parent-selector} [type="file"]::file-selector-button, + #{$parent-selector} [role="button"] { #{$css-var-prefix}background-color: var(#{$css-var-prefix}primary-background); #{$css-var-prefix}border-color: var(#{$css-var-prefix}primary-border); #{$css-var-prefix}color: var(#{$css-var-prefix}primary-inverse); @@ -85,18 +85,18 @@ } } - [type="submit"], - [type="reset"], - [type="button"] { + #{$parent-selector} [type="submit"], + #{$parent-selector} [type="reset"], + #{$parent-selector} [type="button"] { margin-bottom: var(#{$css-var-prefix}spacing); } // .secondary, .contrast & .outline @if $enable-classes { // Secondary - :is(button, [type="submit"], [type="button"], [role="button"]).secondary, - [type="reset"], - [type="file"]::file-selector-button { + #{$parent-selector} :is(button, [type="submit"], [type="button"], [role="button"]).secondary, + #{$parent-selector} [type="reset"], + #{$parent-selector} [type="file"]::file-selector-button { #{$css-var-prefix}background-color: var(#{$css-var-prefix}secondary-background); #{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary-border); #{$css-var-prefix}color: var(#{$css-var-prefix}secondary-inverse); @@ -117,7 +117,7 @@ } // Contrast - :is(button, [type="submit"], [type="button"], [role="button"]).contrast { + #{$parent-selector} :is(button, [type="submit"], [type="button"], [role="button"]).contrast { #{$css-var-prefix}background-color: var(#{$css-var-prefix}contrast-background); #{$css-var-prefix}border-color: var(#{$css-var-prefix}contrast-border); #{$css-var-prefix}color: var(#{$css-var-prefix}contrast-inverse); @@ -137,7 +137,7 @@ } // Outline (primary) - :is(button, [type="submit"], [type="button"], [role="button"]).outline, + #{$parent-selector} :is(button, [type="submit"], [type="button"], [role="button"]).outline, [type="reset"].outline { #{$css-var-prefix}background-color: transparent; #{$css-var-prefix}color: var(#{$css-var-prefix}primary); @@ -151,7 +151,8 @@ } // Outline (secondary) - :is(button, [type="submit"], [type="button"], [role="button"]).outline.secondary, + #{$parent-selector} + :is(button, [type="submit"], [type="button"], [role="button"]).outline.secondary, [type="reset"].outline { #{$css-var-prefix}color: var(#{$css-var-prefix}secondary); #{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary); @@ -163,7 +164,8 @@ } // Outline (contrast) - :is(button, [type="submit"], [type="button"], [role="button"]).outline.contrast { + #{$parent-selector} + :is(button, [type="submit"], [type="button"], [role="button"]).outline.contrast { #{$css-var-prefix}color: var(#{$css-var-prefix}contrast); #{$css-var-prefix}border-color: var(#{$css-var-prefix}contrast); @@ -174,8 +176,8 @@ } } @else { // Secondary button without .class - [type="reset"], - [type="file"]::file-selector-button { + #{$parent-selector} [type="reset"], + #{$parent-selector} [type="file"]::file-selector-button { #{$css-var-prefix}background-color: var(#{$css-var-prefix}secondary-background); #{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary-border); #{$css-var-prefix}color: var(#{$css-var-prefix}secondary-inverse); @@ -196,8 +198,10 @@ } // Button [disabled] - :where(button, [type="submit"], [type="reset"], [type="button"], [role="button"])[disabled], - :where(fieldset[disabled]) + #{$parent-selector} + :where(button, [type="submit"], [type="reset"], [type="button"], [role="button"])[disabled], + #{$parent-selector} + :where(fieldset[disabled]) :is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]) { opacity: 0.5; pointer-events: none; diff --git a/scss/content/_code.scss b/scss/content/_code.scss index 6265364d..a16afd07 100644 --- a/scss/content/_code.scss +++ b/scss/content/_code.scss @@ -13,21 +13,21 @@ // 1. Correct the inheritance and scaling of font size in all browsers // 2. Correct the odd `em` font sizing in all browsers - pre, - code, - kbd, - samp { + #{$parent-selector} pre, + #{$parent-selector} code, + #{$parent-selector} kbd, + #{$parent-selector} samp { font-size: 0.875em; // 2 font-family: var(#{$css-var-prefix}font-family); // 1 } - pre code { + #{$parent-selector} pre code { font-size: inherit; font-family: inherit; } // Prevent overflow of the container in all browsers (opinionated) - pre { + #{$parent-selector} pre { -ms-overflow-style: scrollbar; overflow: auto; } @@ -35,9 +35,9 @@ // Pico // –––––––––––––––––––– - pre, - code, - kbd { + #{$parent-selector} pre, + #{$parent-selector} code, + #{$parent-selector} kbd { border-radius: var(#{$css-var-prefix}border-radius); background: var(#{$css-var-prefix}code-background-color); color: var(#{$css-var-prefix}code-color); @@ -45,13 +45,13 @@ line-height: initial; } - code, - kbd { + #{$parent-selector} code, + #{$parent-selector} kbd { display: inline-block; padding: 0.375rem; } - pre { + #{$parent-selector} pre { display: block; margin-bottom: var(#{$css-var-prefix}spacing); overflow-x: auto; @@ -65,7 +65,7 @@ } // kbd - kbd { + #{$parent-selector} kbd { background-color: var(#{$css-var-prefix}code-kbd-background-color); color: var(#{$css-var-prefix}code-kbd-color); vertical-align: baseline; diff --git a/scss/content/_embedded.scss b/scss/content/_embedded.scss index caf7e889..354a4c41 100644 --- a/scss/content/_embedded.scss +++ b/scss/content/_embedded.scss @@ -12,42 +12,42 @@ // –––––––––––––––––––– // Change the alignment on media elements in all browsers (opinionated) - :where(audio, canvas, iframe, img, svg, video) { + #{$parent-selector} :where(audio, canvas, iframe, img, svg, video) { vertical-align: middle; } // Add the correct display in IE 9- - audio, - video { + #{$parent-selector} audio, + #{$parent-selector} video { display: inline-block; } // Add the correct display in iOS 4-7 - audio:not([controls]) { + #{$parent-selector} audio:not([controls]) { display: none; height: 0; } // Remove the border on iframes in all browsers (opinionated) - :where(iframe) { + #{$parent-selector} :where(iframe) { border-style: none; } // 1. Remove the border on images inside links in IE 10. // 2. Responsive by default - img { + #{$parent-selector} img { max-width: 100%; // 2 height: auto; // 2 border-style: none; // 1 } // Change the fill color to match the text color in all browsers (opinionated) - :where(svg:not([fill])) { + #{$parent-selector} :where(svg:not([fill])) { fill: currentColor; } // Hide the overflow in IE - svg:not(:root) { + #{$parent-selector} svg:not(:root) { overflow: hidden; } } diff --git a/scss/content/_link.scss b/scss/content/_link.scss index c0aa8412..1e33115f 100644 --- a/scss/content/_link.scss +++ b/scss/content/_link.scss @@ -6,8 +6,8 @@ * Link */ - :where(a:not([role="button"])), - [role="link"] { + #{$parent-selector} :where(a:not([role="button"])), + #{$parent-selector} [role="link"] { #{$css-var-prefix}color: var(#{$css-var-prefix}primary); #{$css-var-prefix}background-color: transparent; #{$css-var-prefix}underline: var(#{$css-var-prefix}primary-underline); @@ -61,7 +61,7 @@ } } - a { + #{$parent-selector} a { &[role="button"] { display: inline-block; } diff --git a/scss/content/_miscs.scss b/scss/content/_miscs.scss index 3138d968..cf6de13e 100644 --- a/scss/content/_miscs.scss +++ b/scss/content/_miscs.scss @@ -13,7 +13,7 @@ // 1. Correct the inheritance of border color in Firefox // 2. Add the correct box sizing in Firefox - hr { + #{$parent-selector} hr { height: 0; // 2 margin: var(#{$css-var-prefix}typography-spacing-vertical) 0; border: 0; @@ -22,8 +22,8 @@ } // Add the correct display in IE 10+ - [hidden], - template { + #{$parent-selector} [hidden], + #{$parent-selector} template { @if $enable-important { display: none !important; } @else { @@ -32,7 +32,7 @@ } // Add the correct display in IE 9- - canvas { + #{$parent-selector} canvas { display: inline-block; } } diff --git a/scss/content/_table.scss b/scss/content/_table.scss index a7fb916a..1239bc6f 100644 --- a/scss/content/_table.scss +++ b/scss/content/_table.scss @@ -13,7 +13,7 @@ // 1. Collapse border spacing in all browsers (opinionated) // 2. Remove text indentation from table contents in Chrome, Edge, and Safari - :where(table) { + #{$parent-selector} :where(table) { width: 100%; border-collapse: collapse; // 1 border-spacing: 0; @@ -24,8 +24,8 @@ // –––––––––––––––––––– // Cells - th, - td { + #{$parent-selector} th, + #{$parent-selector} td { padding: calc(var(#{$css-var-prefix}spacing) / 2) var(#{$css-var-prefix}spacing); border-bottom: var(#{$css-var-prefix}border-width) solid @@ -38,7 +38,7 @@ } // Footer - tfoot { + #{$parent-selector} tfoot { th, td { border-top: var(#{$css-var-prefix}border-width) @@ -50,7 +50,7 @@ // Striped @if enable-classes { - table { + #{$parent-selector} table { &.striped { tbody tr:nth-child(odd) th, tbody tr:nth-child(odd) td { diff --git a/scss/content/_typography.scss b/scss/content/_typography.scss index 5af4fdf2..d22956a7 100644 --- a/scss/content/_typography.scss +++ b/scss/content/_typography.scss @@ -12,37 +12,37 @@ // –––––––––––––––––––– // Add the correct font weight in Chrome, Edge, and Safari - b, - strong { + #{$parent-selector} b, + #{$parent-selector} strong { font-weight: bolder; } // Prevent `sub` and `sup` elements from affecting the line height in all browsers - sub, - sup { + #{$parent-selector} sub, + #{$parent-selector} sup { position: relative; font-size: 0.75em; line-height: 0; vertical-align: baseline; } - sub { + #{$parent-selector} sub { bottom: -0.25em; } - sup { + #{$parent-selector} sup { top: -0.5em; } // Pico // –––––––––––––––––––– - address, - blockquote, - dl, - ol, - p, - pre, - table, - ul { + #{$parent-selector} address, + #{$parent-selector} blockquote, + #{$parent-selector} dl, + #{$parent-selector} ol, + #{$parent-selector} p, + #{$parent-selector} pre, + #{$parent-selector} table, + #{$parent-selector} ul { margin-top: 0; margin-bottom: var(#{$css-var-prefix}typography-spacing-vertical); color: var(#{$css-var-prefix}color); @@ -51,12 +51,12 @@ } // Headings - h1, - h2, - h3, - h4, - h5, - h6 { + #{$parent-selector} h1, + #{$parent-selector} h2, + #{$parent-selector} h3, + #{$parent-selector} h4, + #{$parent-selector} h5, + #{$parent-selector} h6 { margin-top: 0; margin-bottom: var(#{$css-var-prefix}typography-spacing-vertical); color: var(#{$css-var-prefix}color); @@ -66,39 +66,40 @@ font-family: var(#{$css-var-prefix}font-family); } - h1 { + #{$parent-selector} h1 { #{$css-var-prefix}color: var(#{$css-var-prefix}h1-color); } - h2 { + #{$parent-selector} h2 { #{$css-var-prefix}color: var(#{$css-var-prefix}h2-color); } - h3 { + #{$parent-selector} h3 { #{$css-var-prefix}color: var(#{$css-var-prefix}h3-color); } - h4 { + #{$parent-selector} h4 { #{$css-var-prefix}color: var(#{$css-var-prefix}h4-color); } - h5 { + #{$parent-selector} h5 { #{$css-var-prefix}color: var(#{$css-var-prefix}h5-color); } - h6 { + #{$parent-selector} h6 { #{$css-var-prefix}color: var(#{$css-var-prefix}h6-color); } // Margin-top for headings after a block - :where(article, address, blockquote, dl, figure, form, ol, p, pre, table, ul) { + #{$parent-selector} + :where(article, address, blockquote, dl, figure, form, ol, p, pre, table, ul) { ~ :is(h1, h2, h3, h4, h5, h6) { margin-top: var(#{$css-var-prefix}typography-spacing-top); } } // Paragraphs - p { + #{$parent-selector} p { margin-bottom: var(#{$css-var-prefix}typography-spacing-vertical); } // Heading group - hgroup { + #{$parent-selector} hgroup { margin-bottom: var(#{$css-var-prefix}typography-spacing-vertical); > * { @@ -114,7 +115,7 @@ } // Lists - :where(ol, ul) { + #{$parent-selector} :where(ol, ul) { li { margin-bottom: calc(var(#{$css-var-prefix}typography-spacing-vertical) * 0.25); } @@ -122,17 +123,17 @@ // Margin-top for nested lists // 1. Remove the margin on nested lists in Chrome, Edge, IE, and Safari - :where(dl, ol, ul) :where(dl, ol, ul) { + #{$parent-selector} :where(dl, ol, ul) :where(dl, ol, ul) { margin: 0; // 1 margin-top: calc(var(#{$css-var-prefix}typography-spacing-vertical) * 0.25); } - ul li { + #{$parent-selector} ul li { list-style: square; } // Highlighted text - mark { + #{$parent-selector} mark { padding: 0.125rem 0.25rem; background-color: var(#{$css-var-prefix}mark-background-color); color: var(#{$css-var-prefix}mark-color); @@ -140,7 +141,7 @@ } // Blockquote - blockquote { + #{$parent-selector} blockquote { display: block; margin: var(#{$css-var-prefix}typography-spacing-vertical) 0; padding: var(#{$css-var-prefix}spacing); @@ -157,25 +158,25 @@ // Abbreviations // 1. Remove underline decoration in Chrome, Edge, IE, Opera, and Safari - abbr[title] { + #{$parent-selector} abbr[title] { border-bottom: 1px dotted; text-decoration: none; // 1 cursor: help; } // Ins - ins { + #{$parent-selector} ins { color: var(#{$css-var-prefix}ins-color); text-decoration: none; } // del - del { + #{$parent-selector} del { color: var(#{$css-var-prefix}del-color); } // selection - ::selection { + #{$parent-selector} ::selection { background-color: var(#{$css-var-prefix}text-selection-color); } } diff --git a/scss/forms/_basics.scss b/scss/forms/_basics.scss index 815ee572..060af840 100644 --- a/scss/forms/_basics.scss +++ b/scss/forms/_basics.scss @@ -15,10 +15,10 @@ // 1. Change the font styles in all browsers // 2. Remove the margin in Firefox and Safari - input, - optgroup, - select, - textarea { + #{$parent-selector} input, + #{$parent-selector} optgroup, + #{$parent-selector} select, + #{$parent-selector} textarea { margin: 0; // 2 font-size: 1rem; // 1 line-height: var(#{$css-var-prefix}line-height); // 1 @@ -27,12 +27,12 @@ } // Show the overflow in IE. - input { + #{$parent-selector} input { overflow: visible; } // Remove the inheritance of text transform in Edge, Firefox, and IE - select { + #{$parent-selector} select { text-transform: none; } @@ -40,7 +40,7 @@ // 2. Correct the color inheritance from `fieldset` elements in IE // 3. Remove the padding so developers are not caught out when they zero out // `fieldset` elements in all browsers - legend { + #{$parent-selector} legend { max-width: 100%; // 1 padding: 0; // 3 color: inherit; // 2 @@ -48,65 +48,65 @@ } // 1. Remove the default vertical scrollbar in IE - textarea { + #{$parent-selector} textarea { overflow: auto; // 1 } // Remove the padding in IE 10 - [type="checkbox"], - [type="radio"] { + #{$parent-selector} [type="checkbox"], + #{$parent-selector} [type="radio"] { padding: 0; } // Correct the cursor style of increment and decrement buttons in Safari - ::-webkit-inner-spin-button, - ::-webkit-outer-spin-button { + #{$parent-selector} ::-webkit-inner-spin-button, + #{$parent-selector} ::-webkit-outer-spin-button { height: auto; } // 1. Correct the odd appearance in Chrome and Safari // 2. Correct the outline style in Safari - [type="search"] { + #{$parent-selector} [type="search"] { -webkit-appearance: textfield; // 1 outline-offset: -2px; // 2 } // Remove the inner padding in Chrome and Safari on macOS - [type="search"]::-webkit-search-decoration { + #{$parent-selector} [type="search"]::-webkit-search-decoration { -webkit-appearance: none; } // 1. Correct the inability to style clickable types in iOS and Safari // 2. Change font properties to `inherit` in Safari - ::-webkit-file-upload-button { + #{$parent-selector} ::-webkit-file-upload-button { -webkit-appearance: button; // 1 font: inherit; // 2 } // Remove the inner border and padding of focus outlines in Firefox - ::-moz-focus-inner { + #{$parent-selector} ::-moz-focus-inner { padding: 0; border-style: none; } // Remove the focus outline in Firefox - :-moz-focusring { + #{$parent-selector} :-moz-focusring { outline: none; } // Remove the additional :invalid styles in Firefox - :-moz-ui-invalid { + #{$parent-selector} :-moz-ui-invalid { box-shadow: none; } // Change the inconsistent appearance in IE (opinionated) - ::-ms-expand { + #{$parent-selector} ::-ms-expand { display: none; } // Remove the border and padding in all browsers (opinionated) - [type="file"], - [type="range"] { + #{$parent-selector} [type="file"], + #{$parent-selector} [type="range"] { padding: 0; border-width: 0; } @@ -115,7 +115,7 @@ // –––––––––––––––––––– // Force height for alternatives input types - input:not([type="checkbox"], [type="radio"], [type="range"]) { + #{$parent-selector} input:not([type="checkbox"], [type="radio"], [type="range"]) { height: calc( (1rem * var(#{$css-var-prefix}line-height)) + (var(#{$css-var-prefix}form-element-spacing-vertical) * 2) + @@ -124,7 +124,7 @@ } // Fieldset - fieldset { + #{$parent-selector} fieldset { width: 100%; margin: 0; margin-bottom: var(#{$css-var-prefix}spacing); @@ -133,39 +133,39 @@ } // Label & legend - label, - fieldset legend { + #{$parent-selector} label, + #{$parent-selector} fieldset legend { display: block; margin-bottom: calc(var(#{$css-var-prefix}spacing) * 0.375); color: var(#{$css-var-prefix}color); font-weight: var(#{$css-var-prefix}form-label-font-weight, var(#{$css-var-prefix}font-weight)); } - fieldset legend { + #{$parent-selector} fieldset legend { margin-bottom: calc(var(#{$css-var-prefix}spacing) * 0.5); } // Blocks, 100% - input:not([type="checkbox"], [type="radio"]), - button[type="submit"], - select, - textarea { + #{$parent-selector} input:not([type="checkbox"], [type="radio"]), + #{$parent-selector} button[type="submit"], + #{$parent-selector} select, + #{$parent-selector} textarea { width: 100%; } // Reset appearance (Not Checkboxes, Radios, Range and File) - input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), - select, - textarea { + #{$parent-selector} input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), + #{$parent-selector} select, + #{$parent-selector} textarea { appearance: none; padding: var(#{$css-var-prefix}form-element-spacing-vertical) var(#{$css-var-prefix}form-element-spacing-horizontal); } // Commons styles - input, - select, - textarea { + #{$parent-selector} input, + #{$parent-selector} select, + #{$parent-selector} textarea { #{$css-var-prefix}background-color: var(#{$css-var-prefix}form-element-background-color); #{$css-var-prefix}border-color: var(#{$css-var-prefix}form-element-border-color); #{$css-var-prefix}color: var(#{$css-var-prefix}form-element-color); @@ -188,7 +188,8 @@ } // Active & Focus - input:not( + #{$parent-selector} + input:not( [type="submit"], [type="button"], [type="reset"], @@ -196,7 +197,7 @@ [type="radio"], [readonly] ), - :where(select, textarea):not([readonly]) { + #{$parent-selector} :where(select, textarea):not([readonly]) { &:is(:active, :focus) { #{$css-var-prefix}background-color: var( #{$css-var-prefix}form-element-active-background-color @@ -205,15 +206,17 @@ } // Active & Focus - input:not([type="submit"], [type="button"], [type="reset"], [role="switch"], [readonly]), - :where(select, textarea):not([readonly]) { + #{$parent-selector} + input:not([type="submit"], [type="button"], [type="reset"], [role="switch"], [readonly]), + #{$parent-selector} :where(select, textarea):not([readonly]) { &:is(:active, :focus) { #{$css-var-prefix}border-color: var(#{$css-var-prefix}form-element-active-border-color); } } // Focus - input:not( + #{$parent-selector} + input:not( [type="submit"], [type="button"], [type="reset"], @@ -221,7 +224,7 @@ [type="file"], [readonly] ), - :where(select, textarea):not([readonly]) { + #{$parent-selector} :where(select, textarea):not([readonly]) { &:focus { #{$css-var-prefix}box-shadow: 0 0 @@ -232,22 +235,23 @@ } // Disabled - input:not([type="submit"], [type="button"], [type="reset"])[disabled], - select[disabled], - textarea[disabled], - label[aria-disabled="true"], - :where(fieldset[disabled]) + #{$parent-selector} input:not([type="submit"], [type="button"], [type="reset"])[disabled], + #{$parent-selector} select[disabled], + #{$parent-selector} textarea[disabled], + #{$parent-selector} label[aria-disabled="true"], + #{$parent-selector} + :where(fieldset[disabled]) :is(input:not([type="submit"], [type="button"], [type="reset"]), select, textarea) { opacity: var(#{$css-var-prefix}form-element-disabled-opacity); pointer-events: none; } - label[aria-disabled="true"] input[disabled] { + #{$parent-selector} label[aria-disabled="true"] input[disabled] { opacity: 1; } // Aria-invalid - :where(input, select, textarea) { + #{$parent-selector} :where(input, select, textarea) { &:not( [type="checkbox"], [type="radio"], @@ -354,7 +358,7 @@ } [dir="rtl"] { - :where(input, select, textarea) { + #{$parent-selector} :where(input, select, textarea) { &:not([type="checkbox"], [type="radio"]) { &:is([aria-invalid], [aria-invalid="true"], [aria-invalid="false"]) { background-position: center left 0.75rem; @@ -364,24 +368,24 @@ } // Placeholder - input::placeholder, - input::-webkit-input-placeholder, - textarea::placeholder, - textarea::-webkit-input-placeholder, - select:invalid { + #{$parent-selector} input::placeholder, + #{$parent-selector} input::-webkit-input-placeholder, + #{$parent-selector} textarea::placeholder, + #{$parent-selector} textarea::-webkit-input-placeholder, + #{$parent-selector} select:invalid { color: var(#{$css-var-prefix}form-element-placeholder-color); opacity: 1; } // Margin bottom (Not Checkboxes and Radios) - input:not([type="checkbox"], [type="radio"]), - select, - textarea { + #{$parent-selector} input:not([type="checkbox"], [type="radio"]), + #{$parent-selector} select, + #{$parent-selector} textarea { margin-bottom: var(#{$css-var-prefix}spacing); } // Select - select { + #{$parent-selector} select { // Unstyle the caret on `