Skip to content
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

ToggleGroupControl: Fix focus and selected style to support Windows High Contrast mode #50785

Merged
merged 3 commits into from
May 23, 2023

Conversation

t-hamano
Copy link
Contributor

@t-hamano t-hamano commented May 19, 2023

Fixes: #50782
Similar to #50772

What?

This PR displays the focus outline and selected outline in ToggleGroupControl when Windows is in high contrast mode.

Why?

Windows high contrast mode does not show box-shadow when focused. In addition, which button is selected or not is not visible in high contrast mode because it is represented only by the background color.

How?

I have added a transparent outline as a focus style. I added a similar transparent outline for which button is selected or not, because the background color is not available.

Screenshots or screencast

screencast.mp4

@@ -80,6 +82,9 @@ export const BackdropView = styled.div`
transition: transform ${ CONFIG.transitionDurationFast } ease;
${ reduceMotion( 'transition' ) }
z-index: 1;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
outline-offset: -3px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

At -2px, the space between outlines seemed too narrow:

offset-2-component

offset-2-block-editor

@t-hamano t-hamano self-assigned this May 19, 2023
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [a11y] Keyboard & Focus labels May 19, 2023
@t-hamano t-hamano requested review from mirka, ciampo and afercia May 19, 2023 13:29
@t-hamano t-hamano marked this pull request as ready for review May 19, 2023 13:29
@t-hamano t-hamano requested a review from ajitbohra as a code owner May 19, 2023 13:29
@github-actions
Copy link

Flaky tests detected in 9b38391.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5024609294
📝 Reported issues:

@joedolson
Copy link
Contributor

This looks great - thanks @t-hamano! The -3px offset seems good to me.

Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

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

LGTM! ❤️

Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Thank you!

@t-hamano t-hamano merged commit 62b3b0e into trunk May 23, 2023
@t-hamano t-hamano deleted the toggle-group-control/windows-focus-selected branch May 23, 2023 00:49
@github-actions github-actions bot added this to the Gutenberg 15.9 milestone May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ToggleGroupControl: No focus style and selected style in Windows high contrast mode
5 participants