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: Unable to remove custom colors on safari. #62554

Closed
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions packages/base-styles/_z-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ $z-layers: (
// For larger views, the wp-admin navbar dropdown should be at top of
// the Publish Post sidebar.
".editor-post-publish-panel {greater than small}": 99998,
// above the sidebar
".components-palette-edit__remove-button": 100010,

// For larger views, the wp-admin navbar dropdown should be on top of
// the multi-entity saving sidebar.
Expand Down
24 changes: 13 additions & 11 deletions packages/components/src/palette-edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ function Option< T extends Color | Gradient >( {
<PaletteItem
className={ isEditing ? 'is-selected' : undefined }
as={ isEditing ? 'div' : 'button' }
onClick={ onStartEditing }
aria-label={
isEditing
? undefined
Expand All @@ -212,7 +211,9 @@ function Option< T extends Color | Gradient >( {
)
}
ref={ setPopoverAnchor }
{ ...( isEditing ? { ...focusOutsideProps } : {} ) }
{ ...( isEditing
? { ...focusOutsideProps }
: { onClick: onStartEditing } ) }
>
<HStack justify="flex-start">
<IndicatorStyled colorValue={ value } />
Expand Down Expand Up @@ -245,14 +246,13 @@ function Option< T extends Color | Gradient >( {
) }
</FlexItem>
{ isEditing && ! canOnlyChangeValues && (
<FlexItem>
<RemoveButton
size="small"
icon={ lineSolid }
label={ __( 'Remove color' ) }
onClick={ onRemove }
/>
</FlexItem>
<RemoveButton
className="components-palette-edit__remove-button"
size="small"
icon={ lineSolid }
label={ __( 'Remove color' ) }
onClick={ onRemove }
/>
) }
</HStack>
{ isEditing && (
Expand Down Expand Up @@ -311,7 +311,9 @@ function PaletteEditListView< T extends Color | Gradient >( {
)
);
} }
onRemove={ () => {
onRemove={ ( event ) => {
event.preventDefault();
event.stopPropagation();
setEditingElement( null );
const newElements = elements.filter(
( _currentElement, currentIndex ) => {
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/palette-edit/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
width: 100%;
}
}

.components-palette-edit__remove-button {
z-index: z-index(".components-palette-edit__remove-button");
}
Loading