Skip to content

fix(utilities): broaden HCM mixin to include macos query#10935

Merged
dakahn merged 8 commits into
carbon-design-system:mainfrom
dakahn:10844-add-macos-hcm-media-query
Mar 18, 2022
Merged

fix(utilities): broaden HCM mixin to include macos query#10935
dakahn merged 8 commits into
carbon-design-system:mainfrom
dakahn:10844-add-macos-hcm-media-query

Conversation

@dakahn

@dakahn dakahn commented Mar 7, 2022

Copy link
Copy Markdown
Contributor

partially closes #10844

Extends our high contrast mixin to include a media query that covers macOS 🏄🏾

Reference

https://adrianroselli.com/2017/11/os-high-contrast-versus-inverted-colors.html#MacOSICMQs

Testing / Reviewing

make sure Dropdown is accessible with macos HCM cranked up 👍🏾

@dakahn dakahn requested a review from tw15egan March 7, 2022 23:45
@dakahn dakahn requested a review from a team as a code owner March 7, 2022 23:45
@dakahn dakahn requested a review from tay1orjones March 7, 2022 23:45
@netlify

netlify Bot commented Mar 7, 2022

Copy link
Copy Markdown

✅ Deploy Preview for carbon-react-next ready!

🔨 Explore the source changes: 089b6e1

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/6234cfa29d12570008c6920c

😎 Browse the preview: https://deploy-preview-10935--carbon-react-next.netlify.app

@netlify

netlify Bot commented Mar 8, 2022

Copy link
Copy Markdown

✅ Deploy Preview for carbon-elements ready!

🔨 Explore the source changes: 089b6e1

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/6234cfa2b2b1ab00080973c0

😎 Browse the preview: https://deploy-preview-10935--carbon-elements.netlify.app

@netlify

netlify Bot commented Mar 8, 2022

Copy link
Copy Markdown

✅ Deploy Preview for carbon-components-react ready!

🔨 Explore the source changes: 089b6e1

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/6234cfa23240fd0008361665

😎 Browse the preview: https://deploy-preview-10935--carbon-components-react.netlify.app

@tay1orjones tay1orjones left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dakahn should this be mirrored over into v10 packages/components?

@tay1orjones

tay1orjones commented Mar 8, 2022

Copy link
Copy Markdown
Member

@dakahn I'm not seeing much (any?) difference. Let me know if there's a different setting I should be testing maybe? I just followed the stuff from the original issue.

hcm-test.mov

@tw15egan

tw15egan commented Mar 8, 2022

Copy link
Copy Markdown
Contributor

I'm also not seeing anything... Seems like it is currently only supported in Safari, but even there it seems like the Highlight CSS color is causing an issue when the increase contrast setting is enabled...

@dakahn

dakahn commented Mar 8, 2022

Copy link
Copy Markdown
Contributor Author

Yep! Botched it lol. Good news is it's hitting the query -- bad news is it looks like our HCM styling is the problem. Since macOS HCM is just a css filter applied top the whole page (rather than a more holistic style sheet rewrite like in Windows) i'm going to see how it works to just exclude a truthy inverted-colors: inverted query 👍🏾

@dakahn dakahn marked this pull request as draft March 9, 2022 00:54
@dakahn

dakahn commented Mar 9, 2022

Copy link
Copy Markdown
Contributor Author

Looks like we can remove prefers-contrast and then browsers in macos wont pick up our HCM styling (which is what we want since they're filters and not stylesheet rewrites). prefers-contrast was how we fixed Firefox in Windows since they didn't want to play nice with the proprietary --ms query.

So it's been a few years since we looked at Firefox in Windows HCM and I thought there was a chance we didn't need that flag anymore. It seems like that might be the case 🎉
image
image
image

I'll give this a more thorough once over in the morning, but anyone else that wants to also take a look on a Windows machine it'd be a big help

@tw15egan

tw15egan commented Mar 9, 2022

Copy link
Copy Markdown
Contributor

@dakahn I just tested in Windows, and don't see any regressions by changing the selector. I also verified that the changes work with Safari and increased contrast enabled. Nice work 🎉

Should we backport this to v10 as well?

@dakahn dakahn marked this pull request as ready for review March 9, 2022 22:13
@dakahn

dakahn commented Mar 9, 2022

Copy link
Copy Markdown
Contributor Author

@tw15egan Radio button was the only one i found, but i updated the component to use the HCM mixin 👍🏾

// Utilize a system color variable to accommodate any user HCM theme
border: 2px solid WindowText;
}
@include high-contrast-mode('icon-fill');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add this and the mixin updates to the V10 package as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tw15egan should i do this in the new fangled v10 branch instead now that @tay1orjones has made that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dakahn Yeah good call, I vote for opening that in a separate PR into the v10 branch

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dakahn @tay1orjones @tw15egan has this been delivered to the v10 branch? If so, can you include a link to that PR?

We're failing a particular WCAG guideline wrt Text Contrast as a result of this issue and our team does not plan to upgrade to v11 in the near term so having this fix in v10 would go a long way. Thanks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fbarroso24 It has not. Thanks for letting us know, we can get this into the v10 branch and cut a release.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fbarroso24 This has been ported to the v10 branch via #11330, and is available in v10.57.1

@dakahn dakahn requested review from tay1orjones and tw15egan March 18, 2022 15:28
@tay1orjones tay1orjones requested review from abbeyhrt and removed request for tw15egan March 18, 2022 15:33
@dakahn dakahn enabled auto-merge (squash) March 18, 2022 18:30
@dakahn dakahn merged commit f2d6651 into carbon-design-system:main Mar 18, 2022
tay1orjones pushed a commit to tay1orjones/carbon that referenced this pull request May 2, 2022
…gn-system#10935)

* fix(utilities): broaden HCM mixin to include macos query

* fix(Utilites): update hcm media query

* fix(Utilities): remove prefers-contrast query

* fix(RadioButton): update styling to use HCM mixin
kodiakhq Bot pushed a commit that referenced this pull request May 3, 2022
* fix(utilities): broaden HCM mixin to include macos query (#10935)

* fix(utilities): broaden HCM mixin to include macos query

* fix(Utilites): update hcm media query

* fix(Utilities): remove prefers-contrast query

* fix(RadioButton): update styling to use HCM mixin

* chore(project): port HCM mixin changes from v10 to v11

Co-authored-by: DAK <40970507+dakahn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[a11y]: dropdown, overflow menu and ghost button text contrast issues with "increase contrast" setting on

5 participants