-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use svg icons as "mask" so their colors could be changed using CSS background-color #426
Conversation
} | ||
|
||
// IE only - hides icon. | ||
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { |
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.
Can we make this a mixin? This seems like something we would want to standardize and have available.
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.
Sounds like a great idea :)
height: 0.65em; | ||
width: 0.65em; | ||
content: ''; | ||
mask: url("#{$image-path}/#{$external-link}.svg") no-repeat 0 0; |
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.
Browser support for this looks limited: https://caniuse.com/#feat=css-masks
Did you check that this spec meets our compatibility requirements? https://github.com/SU-SWS/decanter/wiki/Compatibility
width: 0.65em; | ||
content: ''; | ||
mask: url("#{$image-path}/#{$external-link}.svg") no-repeat 0 0; | ||
mask-size: cover; |
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 doesn't look well supported: https://developer.mozilla.org/en-US/docs/Web/CSS/mask-size#Browser_compatibility
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.
Can you verify that the browser support requirements for Decanter are met?
Yeah, I've tested on desktop Firefox, Safari, Chrome, Edge - those are all ok. I'll test it on Android and iOS. |
@sherakama , I checked a few devices on Browserstack picking not the newest phones on purpose - Galaxy S8 v.7 Chrome, iOS 11 iPhone SE Safari, iOS 10 iPhone 7 Chrome, Pixel 2 Android 8 Firefox and all ok. |
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.
Thank you for testing. This is GTG then.
Cool - I'm writing that IE-only mixin. Should be fairly quick. |
Our compatibility guidelines say we will support the latest version of Edge and 1 back. But the mask only seems to work on the latest version of Edge, i.e. 18. It doesn't render on Edge 17 or 16. I'm totally fine with that - just sayin'. Otherwise, (almost) all the device / browser combinations I tested behave as expected. I had trouble with the default (Samsung) browser on a Galaxy S8, but it was not related to this change. |
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 is a great step forward for us. Thanks!
Yeah, I found out about that last night. Though https://caniuse.com/#search=mask says it can be enabled in Edge 17 behind the flag? Any idea what that means? Is that a setting in the browser? I'm still hoping that this is ok, since Edge is going Chromium soon and I like the ease of being able to change the colors easily. What do you think? 🤔 |
Perhaps we do this in phases. We use this approach for the more decorative icons (e.g., external link), and for components like Main Nav (which it's more important to have the icons visible), we switch to this approach after a newer version of Edge gets pushed out and IE population drops even lower ? |
No Edge 17 users will do this, so it's effectively unsupported.
I'm fine with it being only the latest version of Edge. @sherakama, how about you? |
Hey @JBCSU did you close this PR? 👀 |
@@ -37,10 +37,10 @@ $core-colors: ( | |||
text--high-contrast: #000, | |||
text--reverse: $color-white, | |||
|
|||
link: $color-bright-blue, | |||
link--hover: $color-black, |
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 chose to replace link
and link--hover
with link-inline
and link-inline--hover
to be more explicit about the application. I don't want to have both, so let's decide. I prefer the -inline
variants, in which case please use those. But if you feel strongly that link
and link--hover
are better, then please delete the ones I added and change all references to the -inline
map entries to match
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 like having a clean default link
color without any modifiers since we have clean bg
, text
colors. Also, the -inline
makes me wonder if it only applies to display:inline
links. For example, the links in the vertical link list will probably take on this default link color, but it might be a bit strange if I apply the color link-inline
even though the link might be a block element.
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.
Ok, then please delete the -inline
options and update all references to them to refer to the shorter names.
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.
Done! Added a link--alt and link--alt-hover for cases like the secondary button link style. I feel like the bright red link will appear on some sites in some other ways so I make that the link--alt color.
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.
Ok. I introduced an error in the doc for @function color()
, so I fixed that.
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.
Thanks!!
…secondary button for example)
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 think this is GTG.
Yay, merging before you changed your mind 😂 |
* master: Use svg icons as "mask" so their colors could be changed using CSS background-color (#426)
READY FOR REVIEW
Summary
Investigate the best way to include custom icons into our system #423
Needed By (Date)
Urgency
Steps to Test
Affected Projects or Products
Associated Issues and/or People