Skip to content

Commit

Permalink
Enforce text color on inline boundaries to ensure contrast (#10623)
Browse files Browse the repository at this point in the history
* Enforce text color on inline boundaries to ensure contrast. Fixes #9508

* Darker blue link for WCAG AA contrast
  • Loading branch information
chrisvanpatten committed Oct 15, 2018
1 parent b925931 commit c0f87a2
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions packages/editor/src/components/rich-text/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@
color: $blue-medium-700;
}

&:focus a[data-mce-selected] {
padding: 0 2px;
margin: 0 -2px;
border-radius: 2px;
box-shadow: 0 0 0 1px $blue-medium-100;
background: $blue-medium-100;
}

code {
padding: 2px;
border-radius: 2px;
Expand All @@ -46,11 +38,9 @@
}
}

&:focus code[data-mce-selected] {
background: $light-gray-400;
}

// Style TinyMCE inline boundaries on select inline text elements.
&:focus {
a,
b,
i,
strong,
Expand All @@ -65,8 +55,27 @@
border-radius: 2px;
box-shadow: 0 0 0 1px $light-gray-400;
background: $light-gray-400;

// Enforce a dark text color so active inline boundaries
// are always readable.
// See https://github.com/WordPress/gutenberg/issues/9508
color: $dark-gray-900;
}
}

// Link inline boundaries get special colors.
a[data-mce-selected] {
box-shadow: 0 0 0 1px $blue-medium-100;
background: $blue-medium-100;
color: $blue-medium-900;
}

// <code> inline boundaries need special treatment because their
// un-selected style is already padded.
code[data-mce-selected] {
background: $light-gray-400;
box-shadow: 0 0 0 1px $light-gray-400;
}
}

img {
Expand Down

0 comments on commit c0f87a2

Please sign in to comment.