Search component: Behavior and styling tweaks (https://github.com/woocommerce/woocommerce-admin/pull/5199)
Fix visual issues with the <Search> component.
This commit is contained in:
parent
9906c6c1b3
commit
1bdd2ea0e1
|
@ -220,7 +220,20 @@ export class SelectControl extends Component {
|
|||
}
|
||||
|
||||
search( query ) {
|
||||
this.setState( { query, isFocused: true } );
|
||||
const searchOptions = this.searchOptions || [];
|
||||
const filteredOptions =
|
||||
query !== null && ! query.length && ! this.props.hideBeforeSearch
|
||||
? searchOptions
|
||||
: this.getFilteredOptions( searchOptions, query );
|
||||
|
||||
this.setState( {
|
||||
query,
|
||||
isFocused: true,
|
||||
selectedIndex: 0,
|
||||
filteredOptions,
|
||||
isExpanded: Boolean( filteredOptions.length ),
|
||||
} );
|
||||
|
||||
this.updateFilteredOptions( query );
|
||||
}
|
||||
|
||||
|
@ -236,6 +249,8 @@ export class SelectControl extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
this.searchOptions = searchOptions;
|
||||
|
||||
// Get all options if `hideBeforeSearch` is enabled and query is not null.
|
||||
const filteredOptions =
|
||||
query !== null && ! query.length && ! hideBeforeSearch
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
width: 100%;
|
||||
line-height: 24px;
|
||||
text-align: left;
|
||||
letter-spacing: inherit;
|
||||
background: transparent;
|
||||
|
||||
&::-webkit-search-cancel-button {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
.woocommerce-tag__remove {
|
||||
cursor: pointer;
|
||||
height: inherit;
|
||||
padding: 0 2px;
|
||||
border-radius: 0 12px 12px 0;
|
||||
color: $gray-700;
|
||||
|
|
Loading…
Reference in New Issue