Skip to content

Commit

Permalink
fix: UIO focus styling (resolves #231) (#233)
Browse files Browse the repository at this point in the history
* fix: focus/hover styling to cards and search for uio contrast options

* fix: remove card svg from uio contrast options

* fix: use colour code from infusion

* fix: hover and focus stlying to uio tab

* fix: added styling for current page pagination

* fix: hover and focus styling comment in vendors scss

* fix: apply uio specific styles to uio plus themes

* fix: add hover and focus styling to contrast uio tab

* fix: refactor vendors scss

* fix: replace foregroundColor with fColor and backgroundColor with bColor

* fix: add media query to vendors scss

* fix: removed duplicate uio themes variable

* fix: removed uneeded comments form mixins

* fix: refactored contrast theme styling

moved selectors with curretColor value to mixins scss

* fix: remove uneeded comment

* fix: properly formated rem functions with negative input

* fix: moved each before media queries

* fix: refactored all uio contrast themes stlyling into mixins scss

* fix: placed media query for svg positioning inside mixins scss

* fix: added padding to uio tab on enhance inputs

to prevent hover/focus overlap

* fix: css clean up and adjust code comments

Co-authored-by: Cindy Qi Li <cli@ocadu.ca>
  • Loading branch information
TeddTech and cindyli authored Jun 9, 2020
1 parent 611467e commit 6e375bc
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 57 deletions.
125 changes: 115 additions & 10 deletions src/scss/abstracts/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,23 +1,128 @@
// Mixins.
@mixin adapt-to-highContrast($fColor, $bColor) {
// Social media icons
footer .footer-content .social-media .social-media-icons a {
svg path {
fill: currentColor;
stroke: $bColor;

// To adapt to UIO contrast themes
@mixin adapt-to-uioThemes($fColor, $bColor) {
// WeCount logo
.logo circle,
.logo path {
fill: none;
stroke: var(--logo-stroke, currentColor);
stroke-linecap: round;
stroke-width: rem(3);
}

--logo-stroke: #{$fColor};

// Search icon; IDRC, OCADU and Canada logos
header .site-nav-wrapper .site-nav .search-container svg {
fill: currentColor;
height: rem(19.2);
margin: rem(-25.6);
width: rem(19.2);
}

// Canada logo
--theme-link-fill: currentColor;

// Placeholder images on the "views" page
svg.news-item-img use {
stroke: var(--placeholder-stroke, currentColor);
stroke-linecap: round;
stroke-width: rem(3);
}

--theme-background-fill: #{$bColor};
--placeholder-stroke: #{$fColor};

// Focus/hover styles for SVGs on the footer
footer .footer-content {
// Logos on the footer
.funders a,
.footer-logos a {
padding: rem(5);
}

&:hover,
&:focus {
// Social media icons
.social-media .social-media-icons a {
svg path {
fill: $bColor;
stroke: currentColor;
fill: currentColor;
stroke: $bColor;
}

&:hover,
&:focus {
svg path {
fill: $bColor;
stroke: currentColor;
}
}
}
}

// Focus/hover styles for links
#defaultContainer a:focus,
#defaultContainer a:hover,
#defaultContainer header .site-nav-wrapper .site-nav nav a:focus,
#defaultContainer header .site-nav-wrapper .site-nav nav a:hover,
#defaultContainer .content-wrapper .tags-info .tags a:focus,
#defaultContainer .content-wrapper .tags-info .tags a:hover,
#search-form input,
.card:focus,
.card:hover,
button:focus,
button:hover,
li .pagination-link,
li .pagination-link::before {
box-shadow: inset 0 0 0 rem(2) currentColor;
}

#defaultContainer {
// UIO buttons
.fl-prefsEditor-buttons button {
padding-left: rem(3);
padding-right: rem(3);
}

// Pagination on the contrast theme: previous, next, current page
.content-wrapper main .pagination .pagination-list {
.pagination-next,
.pagination-previous,
li a[aria-current="page"]::before {
box-shadow: none;
}
}

.content-wrapper main .pagination .pagination-list li a[aria-current="page"] {
background-color: $fColor !important; // Enactors.css in infusion uses !important on this element
box-shadow: none;
color: $bColor !important; // Enactors.css in infusion uses !important on this element
&:hover,
&:focus {
box-shadow:
0 0 0 rem(4) $bColor,
0 0 0 rem(6) $fColor;
}
}

// Home page cards: hide background images on UIO contrast themes
.blue,
.green,
.yellow {
background-image: none;
}
}

// Hide ellipsis when a post excerpt is fully displayed
.news-grid .api-content .news-item .preview-content::after {
background: $bColor;
}

@media screen and (min-width: 1024px) {
// Adjust the position of the search icon on the header
header .site-nav-wrapper .site-nav .search-container svg {
height: rem(24);
margin: rem(-40);
width: rem(24);
}
}
}
62 changes: 15 additions & 47 deletions src/scss/vendors/_vendors.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Vendor-specific styles.

//UIO
// *** UIO ***

// UIO button style
#defaultContainer .fl-prefsEditor-separatedPanel .fl-panelBar {
border-bottom: none;
box-shadow: none;
Expand Down Expand Up @@ -31,6 +32,7 @@
}
}

// Stlying for when enhance inputs is turned on
.fl-input-enhanced #defaultContainer .fl-prefsEditor-separatedPanel .fl-panelBar .fl-prefsEditor-buttons {
display: inline-block;
height: rem(88);
Expand Down Expand Up @@ -61,7 +63,15 @@
}
}

@media screen and (min-width: 40em) { // This media query breakpoint comes from the infusion preferences framework for UIO in order to customize UIO button styles on desktop and mobile.
// To adapt to UIO contrast themes
@each $theme, $fColor, $bColor in $UIOThemes {
.fl-theme-#{$theme}, .gpii-ext-theme-#{$theme} {
@include adapt-to-uioThemes($fColor, $bColor);
}
}

// This media query breakpoint comes from the infusion preferences framework for UIO in order to customize UIO button styles on desktop and mobile.
@media screen and (min-width: 40em) {
.fl-input-enhanced #defaultContainer header .fl-prefsEditor-separatedPanel .fl-panelBar .fl-prefsEditor-buttons {
display: block;
height: auto;
Expand All @@ -72,61 +82,19 @@
}

.fl-prefsEditor-reset {
padding: 0;
padding: 0 rem(3);
padding-left: rem(12.8);
}

button[aria-expanded="true"] {
border: none;
padding: 0;
padding: 0 rem(3);
width: unset;
}

button[aria-expanded="false"] {
margin-top: 0;
padding: 0;
padding: 0 rem(3);
}
}
}

// To adapt to UIO high contrast themes
[class^="gpii-ext-theme"],
[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) {
// WeCount logo
.logo circle,
.logo path {
fill: none;
stroke: var(--logo-stroke, currentColor);
stroke-linecap: round;
stroke-width: rem(3);
}

// Search icon; IDRC, OCADU and Canada logos
header .site-nav-wrapper .site-nav .search-container svg {
fill: currentColor;
}

// Canada logo
--theme-link-fill: currentColor;

// Placeholder images on the "views" page
svg.news-item-img use {
stroke: var(--placeholder-stroke, currentColor);
stroke-linecap: round;
stroke-width: rem(3);
}
}

// For styles that require foreground and background colors from each theme
@each $theme, $fColor, $bColor in $UIOThemes {
.fl-theme-#{$theme}, .gpii-ext-theme-#{$theme} {
// WeCount logo
--logo-stroke: #{$fColor};

// The placeholder svg on the "views" page
--theme-background-fill: #{$bColor};
--placeholder-stroke: #{$fColor};

@include adapt-to-highContrast($fColor, $bColor);
}
}

0 comments on commit 6e375bc

Please sign in to comment.