diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 22a08c2f0dd08c..6235f7a05dad49 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -8,7 +8,8 @@ ### Enhancements -- `TabPanel`: Add ability to set icon only tab buttons ([#45005](https://github.com/WordPress/gutenberg/pull/45005)). +- `TabPanel`: Add ability to set icon only tab buttons ([#45005](https://github.com/WordPress/gutenberg/pull/45005)). +- `PaletteEdit`: Global styles: add onChange actions to color palette items [#45681](https://github.com/WordPress/gutenberg/pull/45681) ### Internal diff --git a/packages/components/src/palette-edit/index.js b/packages/components/src/palette-edit/index.js index 5beccbeebfb85a..0fce9bd60f73f0 100644 --- a/packages/components/src/palette-edit/index.js +++ b/packages/components/src/palette-edit/index.js @@ -89,7 +89,7 @@ export function getNameForPosition( elements, slugPrefix ) { ); } -function ColorPickerPopover( { +export function ColorPickerPopover( { isGradient, element, onChange, @@ -101,6 +101,11 @@ function ColorPickerPopover( { offset={ 20 } className="components-palette-edit__popover" onClose={ onClose } + aria-label={ + ! isGradient + ? __( 'Select a new color' ) + : __( 'Select a new gradient' ) + } > { ! isGradient && ( { test( 'should return 1 by default', () => { @@ -61,3 +66,35 @@ describe( 'getNameForPosition', () => { ); } ); } ); + +describe( 'ColorPickerPopover', () => { + it( 'renders the color picker', () => { + render( + {} } + /> + ); + expect( + screen.getByLabelText( 'Select a new color' ) + ).toBeInTheDocument(); + } ); + + it( 'renders the gradient picker', () => { + render( + {} } + /> + ); + expect( + screen.getByLabelText( 'Select a new gradient' ) + ).toBeInTheDocument(); + } ); +} );