Skip to content

fix: search suggestions dropdown does not dismiss on blur

Warren Gifford requested to merge fa/fix-suggestions-showing into master

Created by: attfarhan

Fixes https://github.com/sourcegraph/sourcegraph/issues/7358.

Removes showSuggestions: true from every state update from componentUpdates, because repeat() re-emits all values from the source observable (componentUpdates), therefore, when we hide the menu by emitting suggestionsHidden, showSuggestions gets set to true again right after.

Since we stop setting showSuggestions: true every time componentUpdates completes, the only time showSuggestions is set to true is when the input is focused. We need a way to re-show suggestions if the query input was not un-focused and re-focused in the previous action (e.g. when a user has submitted a search, and then types again to get more suggestions). Now, we listen to changes in the query input value (inputValues), and if the showSuggestions state is false, we set showSuggestions to true.

Merge request reports

Loading