Page MenuHomePhabricator

Adjust search loading indicator to avoid jumps
Closed, ResolvedPublic

Description

After the initial adjustments for showing a loading indicator when searching for an article to translate (T282455) , search results are not cleared when showing the loading indicator.

This results in the search results to "jump" if the user types "almenara" character by character, for example:

Expected result. When typing, the old results can remain visible for up to a second. However, if the new results are not ready by then, the old results will be cleared and only the loading indicator will be visible until the new results arrive.


Related issue with search and loading: T287835: error message saying "no pages found" that shouldn't appear until we complete the search

Event Timeline

Pginer-WMF renamed this task from Adjust search loading indicator to avoid jumps and misleading information to Adjust search loading indicator to avoid jumps.Sep 7 2021, 12:02 PM
Pginer-WMF updated the task description. (Show Details)

Change 719263 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SXArticleSearch: Fix loading indicator and search results issues

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

When typing, the old results can remain visible for up to a second. However, if the new results are not ready by then, the old results will be cleared and only the loading indicator will be visible until the new results arrive

Can this be simplified to common UX pattern? I am not in favor of making it complex and then having rough edges of implmentation show up. Secondly, this component should be able to be replaced by a standard generic component coming from a UI library(wvui or new one) and we should not end up overriding it a lot.

  1. Let the user type, fire the search api only in a debounced manner. That is, when there is x second delay after last keystroke
  2. If search api is going on, show loading indicator and clear current results.

The current implementation at https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ContentTranslation/+/719263/1/app/src/components/SXArticleSearch/useArticleSearch.js#22 adds more complexity and even leaves disclaimer about race conditions.

For references, see typeahead search component implementation in WVUI that is used for the new search feature in wikipedia. It does not even have the loading indicator.

When typing, the old results can remain visible for up to a second. However, if the new results are not ready by then, the old results will be cleared and only the loading indicator will be visible until the new results arrive

Can this be simplified to common UX pattern? I am not in favor of making it complex and then having rough edges of implmentation show up. Secondly, this component should be able to be replaced by a standard generic component coming from a UI library(wvui or new one) and we should not end up overriding it a lot.

  1. Let the user type, fire the search api only in a debounced manner. That is, when there is x second delay after last keystroke
  2. If search api is going on, show loading indicator and clear current results.

The current implementation at https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ContentTranslation/+/719263/1/app/src/components/SXArticleSearch/useArticleSearch.js#22 adds more complexity and even leaves disclaimer about race conditions.

For references, see typeahead search component implementation in WVUI that is used for the new search feature in wikipedia. It does not even have the loading indicator.

That seems a valid approximation for the requirement. If it is simper technically and more solid, let's go with it.
I tried the typeahead search component at Bengali Wikipedia and it works quite well without jumps. If we can achieve a similar result that should be perfect.

Change 721479 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/extensions/ContentTranslation@master] Adjust search loading indicator to avoid jumps

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

Change 719263 abandoned by Nik Gkountas:

[mediawiki/extensions/ContentTranslation@master] SXArticleSearch: Fix loading indicator and search results issues

Reason:

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

Change 721479 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Adjust search loading indicator to avoid jumps

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

Change 730020 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX article search: Show loading indicator as soon as the user types

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

Change 730020 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX article search: Show loading indicator as soon as the user types

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

Change 731310 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.1.0+20211018

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

Change 731310 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.1.0+20211018

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