Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions packages/global-styles-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- Blocks screen: add the hover, focus, focus-visible and active state controls for the Navigation Link block, which already supports those states in `theme.json` and in the block inspector ([#83451](https://github.com/WordPress/gutenberg/pull/83451)).

## 1.23.0 (2026-09-23)

### Enhancements
Expand Down
12 changes: 11 additions & 1 deletion packages/global-styles-ui/src/test/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { getNewIndexFromPresets } from '../utils';
import { getNewIndexFromPresets, getValidPseudoStates } from '../utils';

const validPresets = {
single: [ { slug: 'preset-1' } ],
Expand Down Expand Up @@ -55,3 +55,13 @@ describe( 'getNewIndexFromPresets', () => {
} );
} );
} );

describe( 'getValidPseudoStates', () => {
it( 'offers hover, focus, focus-visible and active for the Navigation Link block', () => {
expect(
getValidPseudoStates( 'core/navigation-link' ).map(
( state ) => state.value
)
).toEqual( [ ':hover', ':focus', ':focus-visible', ':active' ] );
} );
} );
6 changes: 6 additions & 0 deletions packages/global-styles-ui/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export const VALID_BLOCK_STATES: Record< string, StateDefinition[] > = {
{ value: ':focus-visible', label: __( 'Focus-visible' ) },
{ value: ':active', label: __( 'Active' ) },
],
'core/navigation-link': [
{ value: ':hover', label: __( 'Hover' ) },
{ value: ':focus', label: __( 'Focus' ) },
{ value: ':focus-visible', label: __( 'Focus-visible' ) },
{ value: ':active', label: __( 'Active' ) },
],
};

/**
Expand Down
Loading