Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Crash when resetting user color palette. #36233

Merged
merged 1 commit into from
Nov 5, 2021
Merged
Changes from all 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
15 changes: 7 additions & 8 deletions packages/components/src/color-edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import { ColorPicker } from '../color-picker';
import { FlexItem } from '../flex';
import { HStack } from '../h-stack';
import { ItemGroup } from '../item-group';
import { MenuGroup } from '../menu-group';
import { MenuItem } from '../menu-item';
import { VStack } from '../v-stack';
import ColorPalette from '../color-palette';
import DropdownMenu from '../dropdown-menu';
Expand All @@ -37,6 +35,7 @@ import {
DoneButton,
RemoveButton,
} from './styles';
import { NavigableMenu } from '../navigable-container';

function ColorNameInput( { value, onChange } ) {
return (
Expand Down Expand Up @@ -251,11 +250,11 @@ export default function ColorEdit( { colors = EMPTY_ARRAY, onChange } ) {
isSmall: true,
} }
>
{ ( { onClose = () => {} } ) => (
{ ( { onClose } ) => (
<>
<MenuGroup>
<MenuItem
variant={ 'tertiary' }
<NavigableMenu role="menu">
<Button
variant="tertiary"
onClick={ () => {
setEditingColor( null );
setIsEditing( false );
Expand All @@ -264,8 +263,8 @@ export default function ColorEdit( { colors = EMPTY_ARRAY, onChange } ) {
} }
>
{ __( 'Remove all custom colors' ) }
</MenuItem>
</MenuGroup>
</Button>
</NavigableMenu>
</>
) }
</DropdownMenu>
Expand Down