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

Resolve "Edit palette" visual regression in Global Styles > Colors #66481

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
40 changes: 19 additions & 21 deletions packages/edit-site/src/components/global-styles/palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,32 @@ function Palette( { name } ) {
? '/colors/palette'
: '/blocks/' + encodeURIComponent( name ) + '/colors/palette';

const paletteButtonText =
colors.length > 0 ? __( 'Edit palette' ) : __( 'Add colors' );

return (
<VStack spacing={ 3 }>
<Subtitle level={ 3 }>{ __( 'Palette' ) }</Subtitle>
<ItemGroup isBordered isSeparated>
<NavigationButtonAsItem path={ screenPath }>
<NavigationButtonAsItem
path={ screenPath }
aria-label={ paletteButtonText }
>
<HStack direction="row">
{ colors.length > 0 ? (
<>
<ZStack isLayered={ false } offset={ -8 }>
{ colors
.slice( 0, 5 )
.map( ( { color }, index ) => (
<ColorIndicatorWrapper
key={ `${ color }-${ index }` }
>
<ColorIndicator
colorValue={ color }
/>
</ColorIndicatorWrapper>
) ) }
</ZStack>
<FlexItem isBlock>
{ __( 'Edit palette' ) }
</FlexItem>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point of #65124 as discussed in #65112 is to make the accessible name of this button visible by the means of visible text. The visible label must not be removed. I'm not opposed to design changes as long as this button keeps its visible text.

Copy link
Member Author

@richtabor richtabor Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Icon buttons do not have visible text.

</>
) : (
{ colors.length <= 0 && (
<FlexItem>{ __( 'Add colors' ) }</FlexItem>
) }
<ZStack isLayered={ false } offset={ -8 }>
{ colors
.slice( 0, 5 )
.map( ( { color }, index ) => (
<ColorIndicatorWrapper
key={ `${ color }-${ index }` }
>
<ColorIndicator colorValue={ color } />
</ColorIndicatorWrapper>
) ) }
</ZStack>
<Icon icon={ isRTL() ? chevronLeft : chevronRight } />
</HStack>
</NavigationButtonAsItem>
Expand Down
Loading