Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5c2fc63
Align legacy text control focus rings with WPDS.
mirka Aug 7, 2026
f7bafd0
Align ComboboxControl focus ring with WPDS.
mirka Aug 7, 2026
217a79f
Remove input-style__focus mixin.
mirka Aug 7, 2026
6432ad8
Align input-control borders and hover with WPDS.
mirka Aug 7, 2026
4923c6e
Add todo comments
mirka Aug 7, 2026
e9c7f9b
Remove legacy input box-shadow transition.
mirka Aug 7, 2026
baea1ce
Neutralize forms.css focus styles in TextareaControl.
mirka Aug 7, 2026
ea0bfb1
Fix ValidatedTextControl error focus ring.
mirka Aug 7, 2026
c71c4eb
Drop redundant box-shadow reset from input-style__neutral.
mirka Aug 7, 2026
13a1a12
Fix up
mirka Aug 7, 2026
202420b
Restore SandBox changelog entry.
mirka Aug 7, 2026
2858d0c
Use input-control mixin for TextareaControl focus styles.
mirka Aug 7, 2026
9b48706
Merge branch 'trunk' into align-legacy-text-control-focus-rings
mirka Aug 12, 2026
6b25d1d
Drop obsolete validated control invalid styles
mirka Aug 12, 2026
ede4e5b
Use red focus ring for DataViews validated controls
mirka Aug 12, 2026
97b1d7d
Move components changelog entry to Unreleased
mirka Aug 12, 2026
180b8b7
Remove duplicate focus ring from DataViews filter search
mirka Aug 12, 2026
6aaa77c
Add changelog
mirka Aug 12, 2026
1802b39
Add changelog
mirka Aug 12, 2026
c1801e6
Fix up changelog
mirka Aug 12, 2026
ed24d60
Merge trunk into align-legacy-text-control-focus-rings
mirka Aug 13, 2026
325427e
Merge remote branch after trunk merge
mirka Aug 13, 2026
7308b55
Use red-focus-ring placeholder for ToggleGroupControl invalid state
mirka Aug 13, 2026
cd473a3
Merge branch 'trunk' into align-legacy-text-control-focus-rings
mirka Aug 13, 2026
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
5 changes: 5 additions & 0 deletions packages/base-styles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

## Unreleased

### Breaking Changes

- Remove the `input-style__focus` mixin. Use `outset-ring__focus` instead ([#81357](https://github.com/WordPress/gutenberg/pull/81357)).

### Enhancements

- `input-control`: Use `outset-ring__focus` for focus styling, WPDS tokens for border styling, and a hover border treatment aligned with `@wordpress/ui`. If you also define custom `:focus` box-shadow styles on the same selector, remove them to avoid duplicate focus rings ([#81357](https://github.com/WordPress/gutenberg/pull/81357)).
- `outset-ring__focus`: Use a `--focus-color` fallback in the outline instead of declaring the custom property locally, so ancestor overrides apply correctly ([#81242](https://github.com/WordPress/gutenberg/pull/81242)).

## 12.1.0 (2026-08-12)
Expand Down
28 changes: 12 additions & 16 deletions packages/base-styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,11 @@

// Tabs, Inputs, Square buttons.
@mixin input-style__neutral() {
box-shadow: 0 0 0 transparent;
border-radius: variables.$radius-small;
border: variables.$border-width solid colors.$gray-600;

@media not (prefers-reduced-motion) {
transition: box-shadow 0.1s linear;
}
border: wpds.var("--wpds-border-width-xs") solid wpds.var("--wpds-color-stroke-interactive-neutral");
border-radius: wpds.var("--wpds-border-radius-sm");
}


@mixin input-style__focus() {
border-color: var(--wp-admin-theme-color);
// Expand the default border focus style by .5px to be a total of 1.5px.
box-shadow: 0 0 0 0.5px var(--wp-admin-theme-color);
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
}

@mixin button-style__focus() {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);

Expand Down Expand Up @@ -308,8 +295,17 @@
line-height: normal;
}

// TODO: Align `checkbox-control` hover styles with the design system, then drop `[type="checkbox"]` exclusion.
&:hover:not(:disabled, [aria-disabled="true"], [type="checkbox"]) {
border-color: wpds.var("--wpds-color-stroke-interactive-neutral-active");
}

&:focus {
@include input-style__focus();
@include outset-ring__focus();

// Neutralize wp-admin forms.css focus styles.
border-color: wpds.var("--wpds-color-stroke-interactive-neutral");
box-shadow: none;
}
Comment on lines 303 to 309

@ciampo ciampo Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like this shared focus snippet is also used by the Dataviews filter search input

.dataviews-filters__search-widget-filter-combobox__wrapper {
position: relative;
padding: var(--wpds-dimension-padding-sm);
.dataviews-filters__search-widget-filter-combobox__input {
@include input-control;
display: block;
padding: 0 var(--wpds-dimension-padding-sm) 0 var(--wpds-dimension-size-md);
width: 100%;
height: var(--wpds-dimension-size-md);
// Unset inherited values.
margin-left: 0;
margin-right: 0;
/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: vars.$mobile-text-min-font-size;
@include break-small {
font-size: var(--wpds-typography-font-size-md);
}
&:focus {
background: var(--wpds-color-background-surface-neutral-strong);
box-shadow:
inset 0 0 0 var(--wpds-border-width-focus)
var(--wpds-color-stroke-focus);
}

We should clean that up, too, since it currently renders the new outline and the box shadow

Image

(Repro instructions: Storybook, Dataviews => Layout table story, filter by type)


// Use opacity to work in various editor styles.
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Enhancements

- `TextControl`, `TextareaControl`, `FormTokenField`, `ContentEditableControl`, `ComboboxControl`: Align focus and hover styles with the design system ([#81357](https://github.com/WordPress/gutenberg/pull/81357)).
- `InputControl`, `SelectControl`, `CustomSelectControl`: Align focus rings with the design system ([#80417](https://github.com/WordPress/gutenberg/pull/80417)).

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/combobox-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ input.components-combobox-control__input[type="text"] {
padding: 0;

&:focus-within {
@include input-style__focus;
@include outset-ring__focus;
}

.components-spinner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
background: $components-color-background;
color: $components-color-foreground;
@include input-control;
border-color: $components-color-border;

// `::placeholder` only applies to native form fields, so draw the text
// from the `aria-placeholder` attribute while the element has no content.
Expand Down
8 changes: 7 additions & 1 deletion packages/components/src/form-token-field/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
background: $components-color-gray-100;
border-color: $components-color-gray-400;
cursor: default;

// TODO: Use WPDS disabled border tokens once this container is aligned with the design system.
// Until then, cancel `input-control` hover styles (the wrapper uses `.is-disabled`, not `:disabled`).
&:hover {
border-color: $components-color-gray-400;
}
}

&.is-active {
@include input-style__focus;
@include outset-ring__focus;
}

// Token input
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/text-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
background: $components-color-background;
color: $components-color-foreground;
@include input-control;
border-color: $components-color-border;

// Subtract 1px to account for the border, which isn't included on the element
// on newer components like InputControl, SelectControl, etc.
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/textarea-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useInstanceId } from '@wordpress/compose';
import { forwardRef } from '@wordpress/element';
import BaseControl from '../base-control';
import { StyledTextarea } from './styles/textarea-control-styles';
import styles from './style.module.scss';
import type { TextareaControlProps } from './types';
import type { WordPressComponentProps } from '../context';

Expand Down Expand Up @@ -38,7 +39,10 @@ function UnforwardedTextareaControl(
className={ classes }
>
<StyledTextarea
className="components-textarea-control__input"
className={ clsx(
'components-textarea-control__input',
styles.textarea
) }
id={ id }
rows={ rows }
onChange={ onChangeValue }
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/textarea-control/style.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use "@wordpress/base-styles/mixins" as *;

.textarea {
@include input-control;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not a full DS refactor. Only dedupes the styles that can be covered by the input-control mixin.

Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
import styled from '@emotion/styled';
import { css } from '@emotion/react';
import { font } from '../../utils/font';
import { COLORS } from '../../utils/colors-values';
import { CONFIG } from '../../utils';
import { breakpoint } from '../../utils/breakpoint';

const inputStyleNeutral = css`
box-shadow: 0 0 0 transparent;
border-radius: ${ CONFIG.radiusSmall };
border: ${ CONFIG.borderWidth } solid ${ COLORS.ui.border };

@media not ( prefers-reduced-motion ) {
transition: box-shadow 0.1s linear;
}
`;

const inputStyleFocus = css`
border-color: ${ COLORS.theme.accent };
box-shadow: 0 0 0
calc( ${ CONFIG.borderWidthFocus } - ${ CONFIG.borderWidth } )
${ COLORS.theme.accent };

// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
`;

export const StyledTextarea = styled.textarea`
width: 100%;
display: block;
font-family: ${ font( 'default.fontFamily' ) };
line-height: 20px;
background: ${ COLORS.theme.background };
color: ${ COLORS.theme.foreground };
Expand All @@ -42,19 +17,6 @@ export const StyledTextarea = styled.textarea`
// Matching the 20px line-height + the 9px top and bottom padding.
min-height: 38px;

${ inputStyleNeutral };

/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: ${ font( 'mobileTextMinFontSize' ) };

${ breakpoint( 'small' ) } {
font-size: ${ font( 'default.fontSize' ) };
}

&:focus {
${ inputStyleFocus }
}

&:disabled {
background: ${ COLORS.ui.backgroundDisabled };
border-color: ${ COLORS.ui.borderDisabled };
Expand Down
7 changes: 4 additions & 3 deletions packages/components/src/validated-form-controls/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

// For TextareaControl
textarea:invalid[data-validity-visible] {
--wp-admin-theme-color: #{$alert-red};
--wp-components-color-accent: #{$alert-red};
@extend %red-focus-ring;

border-color: $alert-red;
}
}
Expand All @@ -36,7 +36,8 @@
// For ContentEditableControl
&:has(input:invalid[data-validity-visible])
.components-validated-control__content-editable [role="textbox"] {
--wp-admin-theme-color: #{$alert-red};
@extend %red-focus-ring;

border-color: $alert-red;
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/dataviews/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Enhancements

- Validated form controls: Align invalid focus styling for `ComboboxControl` and `FormTokenField` with the design system ([#81357](https://github.com/WordPress/gutenberg/pull/81357)).
- DataViews filters: Align filter search input focus styling with `outset-ring__focus` ([#81357](https://github.com/WordPress/gutenberg/pull/81357)).

### Bug Fix

- Validated form controls: Align invalid focus styling for InputBase-based controls with the design system ([#80417](https://github.com/WordPress/gutenberg/pull/80417)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,6 @@

&:focus {
background: var(--wpds-color-background-surface-neutral-strong);
box-shadow:
inset 0 0 0 var(--wpds-border-width-focus)
var(--wpds-color-stroke-focus);
}

&::placeholder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
.components-combobox-control__suggestions-container:has(
input:invalid[data-validity-visible]
):not(:has([aria-expanded="true"])) {
--wp-admin-theme-color: #{$alert-red};
@extend %red-focus-ring;

border-color: $alert-red;
}
}

Expand All @@ -27,13 +29,14 @@

// For FormTokenField
&:has(input:invalid[data-validity-visible]) .components-form-token-field__input-container:not(:has([aria-expanded="true"])) {
--wp-admin-theme-color: #{$alert-red};
@extend %red-focus-ring;

border-color: $alert-red;
}

// For ToggleGroupControl
&:has(input[type="radio"]:invalid[data-validity-visible]) {
--focus-color: #{$alert-red};
@extend %red-focus-ring;
}
}

Expand Down
2 changes: 1 addition & 1 deletion tools/eslint/suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@
},
"packages/components/src/textarea-control/styles/textarea-control-styles.ts": {
"no-restricted-imports": {
"count": 2
"count": 1
}
},
"packages/components/src/toggle-group-control/toggle-group-control/utils.ts": {
Expand Down
Loading