-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: UIO focus styling (resolves #231) #233
Conversation
This PR needs to be merged AFTER PR #230 |
src/scss/abstracts/_mixins.scss
Outdated
a:focus, | ||
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, { | ||
border: rem(2) solid $c; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greatislander I came up with this solution to get by the linting error that was appearing during check-in. Let me know what you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, that was what I was going to suggest!
There is an outstanding error in this PR that I feel should be addressed in a separate issue. |
src/scss/vendors/_vendors.scss
Outdated
[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) { | ||
// Search icon; IDRC, OCADU and Canada logos | ||
header .site-nav-wrapper .site-nav .search-container svg { | ||
height: 1.5rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/scss/abstracts/_mixins.scss
Outdated
box-shadow: inset 0 0 0 rem(2) $fColor; | ||
} | ||
|
||
#defaultContainer .content-wrapper main .pagination .pagination-list li a[aria-current="page"] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it might be better to combine uio-focus-style()
and adapt-to-highContrast()
functions into one and name it adapt-to-contrastThemes()
because:
- Some code in
uio-focus-style()
deals with non-focus stylings such as this section while some code inadapt-to-highContrast()
deals with focus stylings such as line 41 but not inuio-focus-style()
function; - It's hard to separate out focus/hover code when it is part of an element handling. The styles for social media icons at line 35 is an example.
Please add code comments to each section in the combined function to explain what's handled by that section. Thanks.
src/scss/abstracts/_mixins.scss
Outdated
button:hover, | ||
li .pagination-link, | ||
li .pagination-link::before { | ||
box-shadow: inset 0 0 0 rem(2) $fColor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing $fColor
with currentColor
works the same way. This change will help to move this section of code out of the function into the more generic handling within [class^="gpii-ext-theme"], [class^="fl-theme"]:not(.fl-theme-prefsEditor-default)
. This move will help to reduce the size of the generated css.
src/scss/vendors/_vendors.scss
Outdated
background-image: none; | ||
} | ||
|
||
footer .funders .footer-logos a { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.footer-logos
is not a child of .funders
. This css doesn't apply to logo svgs on the footer. The focus/hover styling on these logos are broken now.
src/scss/abstracts/_mixins.scss
Outdated
color: $bColor !important; // Enactors.css in infusion uses !important on this element | ||
} | ||
|
||
#defaultContainer .content-wrapper main .pagination .pagination-list li a[aria-current="page"]:hover, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This focus/hover styling is for the same element above at line 19. Can you move it in there in the format of:
#defaultContainer .content-wrapper main .pagination .pagination-list li a[aria-current="page"] {
// regular styles
&:hover,
&:focus {
// focus/hover styles
}
Thanks.
src/scss/vendors/_vendors.scss
Outdated
[class^="gpii-ext-theme"], | ||
|
||
// TODO: Address style lint errors when line below is uncommented | ||
// [class^="gpii-ext-theme"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When including the selector .gpii-ext-theme-#{$theme}
for UIO + themes the following linting errors occur:
✖ stylelint found some errors. Please fix them and try committing again.
src/scss/vendors/_vendors.scss
20:3 ✖ Expected selector "[class^="gpii-ext-theme"] footer .footer-logos a" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) footer .funders a" no-descending-specificity
27:2 ✖ Expected selector "[class^="gpii-ext-theme"] #defaultContainer a:hover" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) #defaultContainer a:focus" no-descending-specificity
29:2 ✖ Expected selector "[class^="gpii-ext-theme"] #defaultContainer header .site-nav-wrapper .site-nav nav a:hover" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) #defaultContainer header .site-nav-wrapper .site-nav nav a:focus" no-descending-specificity
30:2 ✖ Expected selector "[class^="gpii-ext-theme"] #defaultContainer .content-wrapper .tags-info .tags a:focus" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) #defaultContainer header .site-nav-wrapper .site-nav nav a:focus" no-descending-specificity
30:2 ✖ Expected selector "[class^="gpii-ext-theme"] #defaultContainer .content-wrapper .tags-info .tags a:focus" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) #defaultContainer header .site-nav-wrapper .site-nav nav a:hover" no-descending-specificity
31:2 ✖ Expected selector "[class^="gpii-ext-theme"] #defaultContainer .content-wrapper .tags-info .tags a:hover" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) #defaultContainer header .site-nav-wrapper .site-nav nav a:focus" no-descending-specificity
31:2 ✖ Expected selector "[class^="gpii-ext-theme"] #defaultContainer .content-wrapper .tags-info .tags a:hover" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) #defaultContainer header .site-nav-wrapper .site-nav nav a:hover" no-descending-specificity
31:2 ✖ Expected selector "[class^="gpii-ext-theme"] #defaultContainer .content-wrapper .tags-info .tags a:hover" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) #defaultContainer .content-wrapper .tags-info .tags a:focus" no-descending-specificity
34:2 ✖ Expected selector "[class^="gpii-ext-theme"] .card:hover" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) .card:focus" no-descending-specificity
36:2 ✖ Expected selector "[class^="gpii-ext-theme"] button:hover" to come before selector "[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) button:focus"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While working on #266, I found CSS attached with the generic selector [class^="gpii-ext-theme"], [class^="fl-theme"]:not(.fl-theme-prefsEditor-default)
sometimes are not applied when another UIO style that is attached with a specific theme selector kicks in. The solution (#269) is to hook up CSS with each specific theme selector.
From the lesson learnt there, I feel the same rule applies to other CSS you have here too. It means to move all css inside [class^="gpii-ext-theme"], [class^="fl-theme"]:not(.fl-theme-prefsEditor-default)
to the mixin function. This change will fix this linting error too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cindyli I have moved only the selectors with a currentColor
value to _mixins.scss
file. Let me now if this is a valid a solution for this linting problem and I will request another review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested with your update. Unfortunately, the similar issue as #266 appears with other css that are not moved from the generic theme into specific theme selector.
Using hiding background image of home page cards as an example:
Turn on "enhance inputs" -> switch to another theme -> the background images of cards show up
These images should not be shown on contrast themes.
moved selectors with curretColor value to mixins scss
@cindyli there are inconsistent hover/focus colours for the last 3 uio contrast themes. Buttons, links, and uio preference panel have different hover/focus colours. I am thinking about addressing this issue in a separate PR. What are your thoughts? |
@TeddTech I agree this could be addressed separately if it is an issue. From what I learnt from @jobara about the last three low contrast themes is they are designed with different set of colors for links, selected texts etc to match contrast themes on Windows (See @jobara's reply on SJRK pull request). It feels to me the hover/focus style for links is correct. But the hover/focus style for UIO buttons ("show perferences", "hide preferences" and "reset") is in question. @jobara and @lliskovoi, what do you think? |
src/scss/vendors/_vendors.scss
Outdated
stroke-width: rem(3); | ||
} | ||
} | ||
|
||
// For styles that require foreground and background colors from each theme | ||
@each $theme, $fColor, $bColor in $UIOThemes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to move this section to before the line 94 since this style belongs to the generic css outside of any specific media query breakpoint. After the change, the structure of this file will be more structured with the media query breakpoints.
src/scss/vendors/_vendors.scss
Outdated
[class^="gpii-ext-theme"], | ||
[class^="fl-theme"]:not(.fl-theme-prefsEditor-default) { | ||
// Search icon; IDRC, OCADU and Canada logos | ||
header .site-nav-wrapper .site-nav .search-container svg { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this css needs to be moved out of the generic selector into theme specific selectors too. Seems you need another loop on $UIOThemes
here.
to prevent hover/focus overlap
npm run lint
without errorsnpm run start
and reviewing affected routesnpm run build
without errorsDescription
This PR adds focus and hover styling to uio contrast options.
Steps to test
npm run start
Expected behavior:
Clear and appropriate focus/hover styling should appear on all webpages when uio contrast options are implemented.
Additional information
N/A
Related issues
closes #231