Skip to content

Commit

Permalink
Set gradient and duotone clear button as disabled if there's no value…
Browse files Browse the repository at this point in the history
…. Add `accessibleWhenDisabled` for all the changes.
  • Loading branch information
juanfra committed Nov 19, 2024
1 parent 731cce4 commit 50d781e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
- `ToggleGroupControl`: Fix active background for `0` value ([#66855](https://github.com/WordPress/gutenberg/pull/66855)).
- `SlotFill`: Fix a bug where a stale value of `fillProps` could be used ([#67000](https://github.com/WordPress/gutenberg/pull/67000)).
- `ColorPalette`: Disable `Clear` button if there's no color value. ([#67108](https://github.com/WordPress/gutenberg/pull/67108)).
- `GradientPicker`: Disable `Clear` button if there's no value. ([#67108](https://github.com/WordPress/gutenberg/pull/67108)).
- `DuotonePicker`: Disable `Clear` button if there's no value. ([#67108](https://github.com/WordPress/gutenberg/pull/67108)).

### Experimental

Expand Down
1 change: 1 addition & 0 deletions packages/components/src/color-palette/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ function UnforwardedColorPalette(
const actions = !! clearable && (
<CircularOptionPicker.ButtonAction
onClick={ clearColor }
accessibleWhenDisabled
disabled={ ! value }
>
{ __( 'Clear' ) }
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/duotone-picker/duotone-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ function DuotonePicker( {
!! clearable && (
<CircularOptionPicker.ButtonAction
onClick={ () => onChange( undefined ) }
accessibleWhenDisabled
disabled={ ! value }
>
{ __( 'Clear' ) }
</CircularOptionPicker.ButtonAction>
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/gradient-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ export function GradientPicker( {
! disableCustomGradients && (
<CircularOptionPicker.ButtonAction
onClick={ clearGradient }
accessibleWhenDisabled
disabled={ ! value }
>
{ __( 'Clear' ) }
</CircularOptionPicker.ButtonAction>
Expand Down

0 comments on commit 50d781e

Please sign in to comment.