Skip to content

Commit

Permalink
ComboboxControl: Update reset button size (WordPress#67215)
Browse files Browse the repository at this point in the history
* ComboboxControl: Update reset button size

* Add changelog

Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent 3381613 commit 08d8b86
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
### Enhancements

- `ColorPicker`: Update sizes of color format select and copy button ([#67093](https://github.com/WordPress/gutenberg/pull/67093)).
- `ComboboxControl`: Update reset button size ([#67215](https://github.com/WordPress/gutenberg/pull/67215)).
- `Autocomplete`: Increase option height ([#67214](https://github.com/WordPress/gutenberg/pull/67214)).

### Experimental
Expand Down
24 changes: 11 additions & 13 deletions packages/components/src/combobox-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import TokenInput from '../form-token-field/token-input';
import SuggestionsList from '../form-token-field/suggestions-list';
import BaseControl from '../base-control';
import Button from '../button';
import { FlexBlock, FlexItem } from '../flex';
import { FlexBlock } from '../flex';
import withFocusOutside from '../higher-order/with-focus-outside';
import { useControlledValue } from '../utils/hooks';
import { normalizeTextString } from '../utils/strings';
Expand Down Expand Up @@ -363,18 +363,16 @@ function ComboboxControl( props: ComboboxControlProps ) {
/>
</FlexBlock>
{ allowReset && (
<FlexItem>
<Button
className="components-combobox-control__reset"
icon={ closeSmall }
// Disable reason: Focus returns to input field when reset is clicked.
// eslint-disable-next-line no-restricted-syntax
disabled={ ! value }
onClick={ handleOnReset }
onKeyDown={ handleResetStopPropagation }
label={ __( 'Reset' ) }
/>
</FlexItem>
<Button
size="small"
icon={ closeSmall }
// Disable reason: Focus returns to input field when reset is clicked.
// eslint-disable-next-line no-restricted-syntax
disabled={ ! value }
onClick={ handleOnReset }
onKeyDown={ handleResetStopPropagation }
label={ __( 'Reset' ) }
/>
) }
</InputWrapperFlex>
{ isExpanded && (
Expand Down
6 changes: 0 additions & 6 deletions packages/components/src/combobox-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,3 @@ input.components-combobox-control__input[type="text"] {
}
}

.components-combobox-control__reset.components-button {
display: flex;
height: $grid-unit-20;
min-width: $grid-unit-20;
padding: 0;
}

0 comments on commit 08d8b86

Please sign in to comment.