Page MenuHomePhabricator

[S] MediaSearch - clearing search items should keep cursor focused in the search field
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. On Special:MediaSearch page type some search items.
  2. Click on 'x' to clear the entered search results - the cursor will be gone from the search field.

Clearing the search items indicate (most likely) that users want to enter other search items. With the current behavior they would need to do an additional click to start typing.

Note:

  • Special:Search and Google search keeps the cursor in the field after clearing search items via 'x'
  • clearing search items in Special:MediaSearch clears also the fetched search results - this behavior differs from Special:Search - is it intentional?

Event Timeline

Etonkovidova renamed this task from MediaSearch - clearing search result should keep cursor focused in the search field to MediaSearch - clearing search items should keep cursor focused in the search field.Aug 26 2020, 10:12 PM
Etonkovidova updated the task description. (Show Details)
CBogen renamed this task from MediaSearch - clearing search items should keep cursor focused in the search field to [S] MediaSearch - clearing search items should keep cursor focused in the search field.Sep 9 2020, 4:40 PM
CBogen added a subscriber: mwilliams.

@mwilliams, should anything persist when you hit the X button? Should the results persist, or the filter settings persist? We assume the autocomplete suggestions should be cleared when the term is cleared.

Should the term be kept in the history if you clear it and then hit the back button?

Presumably everything would be cleared across all tabs, too?

Change 644928 had a related patch set uploaded (by Anne Tomasevich; owner: Anne Tomasevich):
[mediawiki/extensions/WikibaseMediaInfo@master] Keep focus in search input on clear

https://gerrit.wikimedia.org/r/644928

Change 644928 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Keep focus in search input on clear

https://gerrit.wikimedia.org/r/644928

Checked in betalabs - works as expected. - the task should be moved to Verify in Production after @mwilliams review.

Moving to Design QA for @mwilliams to address @CBogen questions.

Here are my clarifications on the quesitons

@mwilliams, should anything persist when you hit the X button? Should the results persist, or the filter settings persist?

Tab selection persists, i.e. enter search terms, select Video tab, select some values in other filters - click Search, then click x to clear the search, only the Video tab stays selected, other selection/input will be cleared.

We assume the autocomplete suggestions should be cleared when the term is cleared.

The autocomplete suggestions works slightly different on Special:MediaSearch - first, it's a combination of auto-suggestions and auto-complete, second- it works as a storage for previous searches that a user has performed. i.e. perform some searches, then clear and then just click in the Search field - the drop-down list of your previous searches will appear.

Should the term be kept in the history if you clear it and then hit the back button?

The current behavior is quite curious (it was reported by me in some MediaSearch ticket, but not as a separate bug).
Make the following searches:

  • the tab Image, the search term: rose, size: medium, File: png
  • the tab Image, the search term: tulip, size: large, File: gif

Click the browser Back button - you'll see

  • the empty search box, but the selected filters (from the most recent search) stay selected

Click the Back button again - you'll see the search for rose but with settings for the tulip, so it will be:
the tab Image, the search term: rose, size: large, File: gif

Presumably everything would be cleared across all tabs, too?

Yes, once x button in the search field is clicked, all search results across all tabs will be cleared.

Looks good and agree with Elena's answers here!