Skip to content

Commit

Permalink
Fix pattern preview focus styles (#60881)
Browse files Browse the repository at this point in the history
The focus styles for the pattern previews were missing. This refactors to have a default focus style that works as a base and then overrides it for the pattern inserter since it uses a large soft shadow for the previews too.

Co-authored-by: jeryj <[email protected]>
Co-authored-by: scruffian <[email protected]>
Co-authored-by: getdave <[email protected]>
  • Loading branch information
4 people authored Apr 22, 2024
1 parent fa3a719 commit 72c1291
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
&:hover,
&:focus {
.block-editor-block-preview__container {
box-shadow:
0 0 0 2px var(--wp-block-synced-color),
0 15px 25px rgb(0 0 0 / 7%);
box-shadow: 0 0 0 2px var(--wp-block-synced-color);
}
}
}
Expand Down
28 changes: 13 additions & 15 deletions packages/block-editor/src/components/block-preview/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,28 @@
z-index: 1;
}

// Restrict these shadows to the context of the inspector.
.interface-interface-skeleton__sidebar {
.block-editor-block-patterns-list__list-item {
.block-editor-block-preview__container {
box-shadow: 0 0 $border-width rgba($black, 0.1);
}
&:hover {
.block-editor-block-preview__container {
box-shadow: 0 0 0 2px $gray-900;
}
}
}
}

// Restrict these shadows to the context of the inserter.
.editor-inserter-sidebar {
.block-editor-block-patterns-list__list-item {
.block-editor-block-patterns-list__item {
.block-editor-block-preview__container {
box-shadow: 0 15px 25px rgb(0 0 0 / 7%);
}
&:focus,
&:hover {
.block-editor-block-preview__container {
box-shadow: 0 0 0 2px $gray-900, 0 15px 25px rgb(0 0 0 / 7%);
}
}

&.block-editor-block-patterns-list__list-item-synced {
&:hover,
&:focus {
.block-editor-block-preview__container {
box-shadow:
0 0 0 2px var(--wp-block-synced-color),
0 15px 25px rgb(0 0 0 / 7%);
}
}
}
}
}

0 comments on commit 72c1291

Please sign in to comment.