Skip to content

Commit

Permalink
ToggleGroupControl: Fix focus and selected style to support Windows H…
Browse files Browse the repository at this point in the history
…igh Contrast mode (#50785)

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

* Add changelog

* Fix unit test
  • Loading branch information
t-hamano committed May 23, 2023
1 parent 7bac5ee commit 62b3b0e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

- `ColorPicker`: Add an outline when the color picker select box is focused([#50609](https://github.com/WordPress/gutenberg/pull/50609)).
- `InputControl`: Fix focus style to support Windows High Contrast mode ([#50772](https://github.com/WordPress/gutenberg/pull/50772)).
- `ToggleGroupControl`: Fix focus and selected style to support Windows High Contrast mode ([#50785](https://github.com/WordPress/gutenberg/pull/50785)).

### Enhancements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = `
.emotion-8:focus-within {
border-color: var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6));
box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
outline: none;
z-index: 1;
outline: 2px solid transparent;
outline-offset: -2px;
}
.emotion-10 {
Expand All @@ -81,6 +82,8 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = `
-webkit-transition: -webkit-transform 160ms ease;
transition: transform 160ms ease;
z-index: 1;
outline: 2px solid transparent;
outline-offset: -3px;
}
@media ( prefers-reduced-motion: reduce ) {
Expand Down Expand Up @@ -402,8 +405,9 @@ exports[`ToggleGroupControl should render correctly with text options 1`] = `
.emotion-8:focus-within {
border-color: var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6));
box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
outline: none;
z-index: 1;
outline: 2px solid transparent;
outline-offset: -2px;
}
.emotion-10 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ const enclosingBorders = ( isBlock: ToggleGroupControlProps[ 'isBlock' ] ) => {
&:focus-within {
border-color: ${ COLORS.ui.borderFocus };
box-shadow: ${ CONFIG.controlBoxShadowFocus };
outline: none;
z-index: 1;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
outline-offset: -2px;
}
`;
};
Expand Down Expand Up @@ -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;
`;

export const VisualLabelWrapper = styled.div`
Expand Down

1 comment on commit 62b3b0e

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 62b3b0e.
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/5051866553
📝 Reported issues:

Please sign in to comment.