Skip to content

Commit

Permalink
NavigationMenu component: Add isSearchDebouncing prop (#28102)
Browse files Browse the repository at this point in the history
Complementary PR for #27280
  • Loading branch information
david-szabo97 authored Jan 19, 2021
1 parent 0585c2f commit 49cff25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/components/src/navigation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ The unique identifier of the menu. The root menu can omit this, and it will defa

When `hasSearch` is active, this function handles the search input's `onChange` event, making it controlled from the outside. It requires setting the `search` prop as well.

### isSearchDebouncing

- Type: `boolean`
- Required: No

Indicates whether the search is debouncing or not. In case of `true` the "No results found." text is omitted. Used to prevent showing "No results found." text between debounced searches.

### `parentMenu`

- Type: `string`
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/navigation/menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default function NavigationMenu( props ) {
onSearch: setControlledSearch,
parentMenu,
search: controlledSearch,
isSearchDebouncing,
title,
titleAction,
} = props;
Expand Down Expand Up @@ -84,7 +85,7 @@ export default function NavigationMenu( props ) {
<NavigableMenu>
<ul aria-labelledby={ menuTitleId }>
{ children }
{ search && (
{ search && ! isSearchDebouncing && (
<NavigationSearchNoResultsFound search={ search } />
) }
</ul>
Expand Down

0 comments on commit 49cff25

Please sign in to comment.