Skip to content

Commit

Permalink
Use real labels instaed of headings or aria-labels.
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed Jul 24, 2024
1 parent 0b94a19 commit a877444
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
__experimentalInputControl as InputControl,
__experimentalUnitControl as UnitControl,
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
__experimentalGrid as Grid,
__experimentalDropdownContentWrapper as DropdownContentWrapper,
__experimentalUseNavigator as useNavigator,
__experimentalToggleGroupControl as ToggleGroupControl,
Expand Down Expand Up @@ -455,7 +454,7 @@ function ShadowPopover( { shadowObj, onChange } ) {
label={ __( 'Inset' ) }
/>
</ToggleGroupControl>
<Grid columns={ 2 } gap={ 4 }>
<VStack gap={ 4 }>
<ShadowInputControl
label={ __( 'X Position' ) }
value={ shadowObj.x }
Expand Down Expand Up @@ -483,7 +482,7 @@ function ShadowPopover( { shadowObj, onChange } ) {
onShadowChange( 'spread', value )
}
/>
</Grid>
</VStack>
</VStack>
</div>
);
Expand All @@ -506,29 +505,18 @@ function ShadowInputControl( { label, value, onChange, hasNegativeRange } ) {
};

return (
<VStack justify="flex-start">
<HStack justify="space-between">
<Subtitle>{ label }</Subtitle>
<Button
label={ __( 'Use custom size' ) }
icon={ settings }
onClick={ () => {
setIsCustomInput( ! isCustomInput );
} }
isPressed={ isCustomInput }
size="small"
/>
</HStack>
<HStack align="flex-end">
{ isCustomInput ? (
<UnitControl
label={ label }
hideLabelFromVision
__next40pxDefaultSize
value={ value }
onChange={ onValueChange }
className="edit-site-global-styles__shadow-editor-control"
/>
) : (
<RangeControl
label={ label }
value={ parsedQuantity ?? 0 }
onChange={ sliderOnChange }
withInputField={ false }
Expand All @@ -548,8 +536,24 @@ function ShadowInputControl( { label, value, onChange, hasNegativeRange } ) {
step={
CUSTOM_VALUE_SETTINGS[ parsedUnit ?? 'px' ]?.step ?? 0.1
}
className="edit-site-global-styles__shadow-editor-control"
/>
) }
</VStack>
<Flex
expanded={ false }
align="center"
className="edit-site-global-styles__shadow-editor-control-toggle-wrapper"
>
<Button
label={ __( 'Use custom size' ) }
icon={ settings }
onClick={ () => {
setIsCustomInput( ! isCustomInput );
} }
isPressed={ isCustomInput }
size="small"
/>
</Flex>
</HStack>
);
}
9 changes: 9 additions & 0 deletions packages/edit-site/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@
// color palette adds empty .components-circular-option-picker
margin-bottom: -1 * $grid-unit-05;
}

.edit-site-global-styles__shadow-editor-control {
flex-grow: 1;
}

.edit-site-global-styles__shadow-editor-control-toggle-wrapper {
// Make the button wrapper height the same as the adjacent input height.
height: $button-size-next-default-40px;
}
}

.edit-site-global-styles__shadow-editor__dropdown {
Expand Down

0 comments on commit a877444

Please sign in to comment.