Fix invisible text selection on brand text

When an element had a text using the brand color and was a child of an
element with a brand background, the selection was invisible.
This commit is contained in:
Javi Martín
2021-03-12 21:04:10 +01:00
parent f124828cd8
commit 4bb12c573f
8 changed files with 46 additions and 27 deletions

View File

@@ -204,8 +204,8 @@ $table-header: #ecf1f6;
line-height: $line-height * 2; line-height: $line-height * 2;
.button { .button {
@include brand-text;
background: #fff; background: #fff;
color: $brand;
} }
} }
} }
@@ -677,7 +677,7 @@ code {
display: block; display: block;
&.is-active { &.is-active {
color: $brand; @include brand-text;
font-weight: bold; font-weight: bold;
text-decoration: underline; text-decoration: underline;
} }

View File

@@ -320,7 +320,7 @@
} }
.is-active { .is-active {
color: $brand; @include brand-text;
position: relative; position: relative;
&::before { &::before {
@@ -335,7 +335,7 @@
} }
a { a {
color: $brand; @include brand-text;
~ a { ~ a {
color: $text; color: $text;
@@ -343,7 +343,7 @@
} }
[class^="icon-"] { [class^="icon-"] {
color: $brand; @include brand-text;
} }
} }
@@ -358,7 +358,7 @@
border-bottom: 2px solid $brand; border-bottom: 2px solid $brand;
.has-tip { .has-tip {
color: $brand; @include brand-text;
font-weight: bold; font-weight: bold;
} }
} }

View File

@@ -29,8 +29,8 @@
// 01. Global styles // 01. Global styles
// ----------------- // -----------------
::selection { * {
@include brand-background($invert-selection: false); @include normal-selection;
} }
html, html,
@@ -96,6 +96,7 @@ a {
} }
.button.hollow { .button.hollow {
@include normal-selection;
border: 1px solid $link; border: 1px solid $link;
color: $link; color: $link;
} }
@@ -248,12 +249,12 @@ a {
} }
&.is-active { &.is-active {
@include brand-text;
border-bottom: 2px solid $brand; border-bottom: 2px solid $brand;
color: $brand;
padding-bottom: rem-calc(1); padding-bottom: rem-calc(1);
h2 a { h2 a {
color: $brand; @include brand-text;
} }
} }
@@ -279,8 +280,8 @@ a {
padding: 0; padding: 0;
&.is-active { &.is-active {
@include brand-text;
font-weight: bold; font-weight: bold;
color: $brand;
} }
} }
@@ -289,8 +290,8 @@ a {
} }
&.is-active { &.is-active {
@include brand-text;
border-bottom: 2px solid $brand; border-bottom: 2px solid $brand;
color: $brand;
} }
} }
@@ -352,15 +353,15 @@ a {
position: relative; position: relative;
&:hover { &:hover {
@include brand-text;
background: none; background: none;
color: $brand;
text-decoration: none; text-decoration: none;
} }
&[aria-selected="true"], &[aria-selected="true"],
&.is-active { &.is-active {
@include brand-text;
border-bottom: 0; border-bottom: 0;
color: $brand;
font-weight: bold; font-weight: bold;
&::after { &::after {
@@ -527,11 +528,11 @@ body > header,
padding: rem-calc(6); padding: rem-calc(6);
[type="submit"] { [type="submit"] {
@include brand-text;
background: none; background: none;
border: 0; border: 0;
cursor: pointer; cursor: pointer;
font-weight: bold; font-weight: bold;
color: $brand;
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
@@ -615,8 +616,8 @@ body > header,
text-align: left; text-align: left;
@include breakpoint(medium) { @include breakpoint(medium) {
@include brand-text;
background: #fff; background: #fff;
color: $brand;
text-align: center; text-align: center;
} }
} }
@@ -776,8 +777,8 @@ body > header,
color: #fff; color: #fff;
@include breakpoint(medium) { @include breakpoint(medium) {
@include brand-text;
border-bottom: 2px solid $brand; border-bottom: 2px solid $brand;
color: $brand;
} }
} }
} }
@@ -848,8 +849,8 @@ body > header,
} }
.is-active { .is-active {
@include brand-text;
border-bottom: 2px solid $brand; border-bottom: 2px solid $brand;
color: $brand;
&:hover { &:hover {
text-decoration: none; text-decoration: none;
@@ -1638,7 +1639,7 @@ table {
text-decoration: none; text-decoration: none;
&:hover { &:hover {
color: $brand; @include brand-text;
} }
} }
} }

View File

@@ -144,8 +144,8 @@
margin-bottom: rem-calc(40); margin-bottom: rem-calc(40);
.debate-type { .debate-type {
@include brand-text;
text-transform: uppercase; text-transform: uppercase;
color: $brand;
font-weight: 700; font-weight: 700;
font-size: $small-font-size; font-size: $small-font-size;
@@ -155,7 +155,7 @@
} }
.debate-title a { .debate-title a {
color: $brand; @include brand-text;
} }
} }
@@ -208,7 +208,7 @@
} }
h4 a { h4 a {
color: $brand; @include brand-text;
&:hover { &:hover {
text-decoration: none; text-decoration: none;
@@ -225,8 +225,8 @@
} }
.quiz-next { .quiz-next {
@include brand-text;
background: #ccdbe5; background: #ccdbe5;
color: $brand;
font-size: $small-font-size; font-size: $small-font-size;
font-weight: bold; font-weight: bold;
text-align: right; text-align: right;

View File

@@ -15,6 +15,7 @@
@mixin hollow-button($color: $link) { @mixin hollow-button($color: $link) {
@include button($style: hollow, $background: $color); @include button($style: hollow, $background: $color);
@include normal-selection;
@extend %button; @extend %button;
margin-bottom: 0; margin-bottom: 0;
} }

View File

@@ -7,6 +7,19 @@
} }
} }
@mixin brand-text {
@include normal-selection;
color: $brand;
}
@mixin normal-selection {
&::selection,
*::selection {
@include brand-background($invert-selection: false);
}
}
@mixin inverted-selection { @mixin inverted-selection {
&::selection, &::selection,
@@ -19,3 +32,7 @@
%brand-background { %brand-background {
@include brand-background; @include brand-background;
} }
%brand-text {
@include brand-text;
}

View File

@@ -52,7 +52,7 @@
.more-info-content { .more-info-content {
h3 { h3 {
color: $brand; @include brand-text;
} }
.additional-info { .additional-info {

View File

@@ -991,7 +991,7 @@
} }
.is-active { .is-active {
color: $brand; @include brand-text;
&::after { &::after {
content: "\6c"; content: "\6c";
@@ -1211,15 +1211,15 @@
} }
.button { .button {
@include brand-text;
background: #fff; background: #fff;
color: $brand;
margin-bottom: rem-calc(3); margin-bottom: rem-calc(3);
text-decoration: none; text-decoration: none;
} }
} }
.current-phase { .current-phase {
color: $brand; @include brand-text;
} }
.progress-votes { .progress-votes {