Page MenuHomePhabricator

Clicking On The "clear" Button In The Home Page Search Field Submits An Empty Query Instead
Closed, DeclinedPublicBUG REPORT

Description

List of steps to reproduce:

  • Visit the home page of toolhub and input string into the search box
  • instead of clicking the search icon, click on the clear icon instead

What happens?:
Instead of clearing the search input field only, toolhub clears the search input field but also tries performing a search. This causes it to send an empty query to the backend since by the time of making the api call, the query is already empty.

What should have happened instead?:
when the clear icon is clicked, it should clear the input field then wait for the user to input another query. It shouldn't try to perform search when the user clicks the clear icon.

This might be intentional but the ux flow is wrong. When a user clicks on a clear icon, they are trying to clear the query they already typed and perhaps input another query. submitting an empty query and sending the user to the search result page seems like a wrong flow.

Event Timeline

This behavior is intentional when the SearchBar component is used from the search screen. On the home screen it is I suppose accidental. The SearchBar component emits the same "search" event when the user presses the enter key inside the field, clicks the clear button, or clicks the search button. Either multiple events or a feature flag to disable emitting the "search" event when clearing would be needed to make the component behave differently on the home screen.

Let's figure out how to fix this problem of unexpected navigation away from the home screen when clearing the search input as part of T306534: Searching the hub should be more discoverable.