Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

button.components-button.block-editor-block-styles__item {

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.

Block Inspector > Style Variations

Image Image

color: $gray-900;
box-shadow: inset 0 0 0 $border-width $gray-300;
border-color: $gray-300;
display: inline-block;
width: calc(50% - #{$grid-unit-05});

Expand All @@ -52,7 +52,7 @@

&:focus,
&.is-active:focus {
@include block-toolbar-button-style__focus();
@include outset-ring__focus();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@
width: 100%;
height: auto;
color: $gray-900;
box-shadow: inset 0 0 0 $border-width $gray-900;
border-color: currentColor;

.is-dark-theme & {
color: $light-gray-placeholder;
box-shadow: inset 0 0 0 $border-width $light-gray-placeholder;
}

&:hover {
color: var(--wp-admin-theme-color);
box-shadow: inset 0 0 0 $border-width var(--wp-admin-theme-color);
}

&:focus {
box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color);
}

&:active {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
width: 100%;
height: auto;
padding: $grid-unit-15;
box-shadow: inset 0 0 0 1px $gray-600;
border-color: $gray-600;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@

.block-editor-content-only-controls__link {

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.

Enable Block fields experiments > Insert an Image block > Block inspector > Link button

Image Image

width: 100%;
box-shadow: inset 0 0 0 $border-width $gray-400;

&:focus:not(:disabled) {
// Allow smooth transition between focused and unfocused box-shadow states.
box-shadow: 0 0 0 currentColor inset, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}
border-color: $gray-400;
}

.block-editor-content-only-controls__link-row {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@

.block-editor-content-only-controls__media {

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.

Enable Block fields experiments > Insert an Image block > Block inspector > Media

Image Image

width: 100%;
box-shadow: inset 0 0 0 $border-width $gray-400;
border-color: $gray-400;
padding-right: $grid-unit-40;

&:focus:not(:disabled) {
// Allow smooth transition between focused and unfocused box-shadow states.
box-shadow: 0 0 0 currentColor inset, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}
}

.block-editor-content-only-controls__media-replace-flow {
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
grid-column: span 2;

&.open {
box-shadow: inset 0 0 0 $border-width $gray-200;
outline: 1px solid transparent; // Box shadow is removed in high contrast mode, a transparent outline is made opaque.
border-color: $gray-200;
background-color: $white;
}
}
Expand Down
6 changes: 1 addition & 5 deletions packages/block-library/src/utils/media-control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

button.components-button {
color: $gray-900;
box-shadow: inset 0 0 0 1px $gray-400;
border-color: $gray-400;
width: 100%;
display: block;
height: $grid-unit-50;
Expand All @@ -25,10 +25,6 @@
&:hover {
color: var(--wp-admin-theme-color);
}

&:focus {
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- `BorderControl` ([#79418](https://github.com/WordPress/gutenberg/pull/79418))
- `FontSizePicker` ([#79481](https://github.com/WordPress/gutenberg/pull/79481))
- `ToggleGroupControl` ([#79656](https://github.com/WordPress/gutenberg/pull/79656))
- `Button`: Render the secondary variant's border with a real `border` instead of `box-shadow` ([#79982](https://github.com/WordPress/gutenberg/pull/79982)).

### Documentation

Expand Down
7 changes: 1 addition & 6 deletions packages/components/src/button-group/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
border-radius: 0;
display: inline-flex;
color: $gray-900;
box-shadow: inset 0 0 0 $border-width $gray-900;
border-color: $gray-900;

& + .components-button {
margin-left: -1px;
Expand All @@ -29,10 +29,5 @@
position: relative;
z-index: 1;
}

// The active button should look pressed.
&.is-primary {
box-shadow: inset 0 0 0 $border-width $gray-900;
}
}
}
49 changes: 22 additions & 27 deletions packages/components/src/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
font-size: $default-font-size;
font-weight: $font-weight-medium;
margin: 0;
border: 0;
cursor: var(--wpds-cursor-control);
appearance: none;
background: none;
Expand All @@ -32,6 +31,9 @@
padding: 4px 12px; // Allows 32px min-height.
border-radius: $radius-small;
color: $components-color-foreground;
// Every variant reserves a 1px border (transparent by default) so the box
// size stays identical whether or not a variant paints a visible border.
border: $border-width solid transparent;

&.is-next-40px-default-size {
height: $button-size-next-default-40px;
Expand Down Expand Up @@ -88,10 +90,6 @@
);
/* stylelint-enable */
}

@media (forced-colors: active) {
outline: 1px solid ButtonBorder;
}
}

/**
Expand All @@ -100,21 +98,13 @@

&.is-secondary,
&.is-tertiary {
&:active:not(:disabled) {
box-shadow: none;
}

&:disabled,
&[aria-disabled="true"],
&[aria-disabled="true"]:hover {
color: $gray-600;
background: transparent;
transform: none;
}

@media (forced-colors: active) {
outline: 1px solid ButtonBorder;
}
}

/**
Expand All @@ -123,36 +113,33 @@

&.is-secondary {
@media not ( prefers-reduced-motion ) {
transition: box-shadow 0.1s linear;
transition: border-color 0.1s linear;
}

box-shadow:
inset 0 0 0 $border-width $components-color-accent,
0 0 0 currentColor;
border-color: $components-color-accent;
white-space: nowrap;
color: $components-color-accent;
background: transparent;

&:active:not(:disabled) {
// Hide the border while pressed, keeping its width to avoid a size shift.
border-color: transparent;
}

&:hover:not(:disabled, [aria-disabled="true"], .is-pressed) {
box-shadow: inset 0 0 0 $border-width $components-color-accent-darker-20;
border-color: $components-color-accent-darker-20;
color: $components-color-accent-darker-20;
background: color-mix(in srgb, $components-color-accent 4%, transparent);
}

&:focus:not(:active) {
// Restore the visual border that the outset-ring__focus mixin resets.
box-shadow: inset 0 0 0 $border-width $components-color-accent, 0 0 0 currentColor;
border-color: $components-color-accent;
}

&:disabled:not(:focus),
&[aria-disabled="true"]:not(:focus),
&[aria-disabled="true"]:hover:not(:focus) {
box-shadow: inset 0 0 0 $border-width var(--wpds-color-stroke-interactive-neutral-disabled);
}

@media (forced-colors: active) {
// Inset box-shadow borders are not reliable in forced-colors mode.
box-shadow: none;
border-color: var(--wpds-color-stroke-interactive-neutral-disabled);
}
}

Expand Down Expand Up @@ -225,7 +212,6 @@
&.is-link {
margin: 0;
padding: 0;
box-shadow: none;
border: 0;
border-radius: 0;
background: none;
Expand Down Expand Up @@ -336,6 +322,15 @@
padding-left: $grid-unit-15;
}
}

// Offset the reserved 1px border so it doesn't widen the square
// icon button.
&:not(.has-text) {
svg,
.dashicon {
margin-inline: -$border-width;
}
}
}

// Toggled style.
Expand Down
11 changes: 1 addition & 10 deletions packages/editor/src/components/post-featured-image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
.editor-post-featured-image__preview {

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.

Block Inspector > Featured Image

Image Image Image Image

width: 100%;
padding: 0;
box-shadow: 0 0 0 0 var(--wp-admin-theme-color);
border-color: $gray-400;
overflow: hidden; // Ensure the focus style properly encapsulates the image.
outline-offset: -#{$border-width};
min-height: $grid-unit-50;
Expand All @@ -76,15 +76,6 @@
}
}

.editor-post-featured-image__toggle {
box-shadow: inset 0 0 0 $border-width $gray-400;

&:focus:not(:disabled) {
// Allow smooth transition between focused and unfocused box-shadow states.
box-shadow: 0 0 0 currentColor inset, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}
}

.editor-post-featured-image__actions {
&:not(.editor-post-featured-image__actions-missing-image) {
bottom: 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/src/blocks/widget-group/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
// Force the appender to always have "light mode" styling as it appears in a
// light colored placeholder.
.is-dark-theme .wp-block-widget-group__placeholder .block-editor-button-block-appender {

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.

Enable dark background color for the classic theme> Widget editor > Widget group block

Image Image

box-shadow: inset 0 0 0 $border-width $gray-900;
border-color: currentColor;
color: $gray-900;
}
Loading