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

Fix flickering when focusing on global style variations #55267

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions packages/edit-site/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,35 @@

.edit-site-global-styles-variations_item {
box-sizing: border-box;
// To round the outline in Windows 10 high contrast mode.
border-radius: $radius-block-ui;

.edit-site-global-styles-variations_item-preview {
padding: $border-width * 2;
border-radius: $radius-block-ui;
border: $gray-200 $border-width solid;
box-shadow: 0 0 0 $border-width $gray-200;
// Shown in Windows 10 high contrast mode.
outline: 1px solid transparent;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick we have this for other high contrast mode contexts:

// Windows high contrast mode.
outline: 2px solid transparent;

Completely separate, I wonder if we should create a mixin for this, then the mixin can contain the named context so we don't need a CSS comment, and it can be consistent across.

}

&.is-active .edit-site-global-styles-variations_item-preview {
border: $gray-900 $border-width solid;
box-shadow: 0 0 0 $border-width $gray-900;
// Shown in Windows 10 high contrast mode.
outline-width: 3px;
}

&:hover .edit-site-global-styles-variations_item-preview {
border: var(--wp-admin-theme-color) $border-width solid;
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
}

&:focus .edit-site-global-styles-variations_item-preview {
border: var(--wp-admin-theme-color) var(--wp-admin-border-width-focus) solid;
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}

&:focus-visible {
// Shown in Windows 10 high contrast mode.
outline: 3px solid transparent;
outline-offset: 0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,16 @@
}

.edit-site-global-styles-variations_item-preview {
border: $gray-900 $border-width solid;
box-shadow: 0 0 0 $border-width $gray-900;
}
.edit-site-global-styles-variations_item.is-active .edit-site-global-styles-variations_item-preview {
border: $gray-100 $border-width solid;
box-shadow: 0 0 0 $border-width $gray-100;
}
.edit-site-global-styles-variations_item:hover .edit-site-global-styles-variations_item-preview {
border: var(--wp-admin-theme-color) $border-width solid;
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
}

.edit-site-global-styles-variations_item:focus .edit-site-global-styles-variations_item-preview {
border: var(--wp-admin-theme-color) var(--wp-admin-border-width-focus) solid;
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}
}

Expand Down
Loading