Page MenuHomePhabricator

Newcomer tasks: Animate the "live broadcast" icon in the Suggested edits results overlay
Closed, ResolvedPublic

Description

User story
When using the tasks filter, I want some feedback when I change filter options that different articles are being found based on my selections.

Proposed solution
Animate the "live-broadcast" icon next to the count of article results to indicate that matching articles are being found.

See animated SVG here: http://reetssydney.github.io/prototypes/live-broadcast/index.html

Asset:

CSS:

@keyframes play45 {
  0% {
    background-position: 0px 0px;
  }
  100% {
    background-position: -900px 0px;
  }
}
.shapeshifter {
  animation-duration: 3000ms;
  animation-timing-function: steps(45);
  animation-iteration-count:infinite;
  width: 20px;
  height: 20px;
  background-image: url(livebroadcast-anim.svg);
  background-repeat: no-repeat;
}
.shapeshifter.play {
  animation-name: play45;
}

Event Timeline

Is the goal here to animate the icon while the search is running in the background, or to animate it for a short time once the results have been updated, to draw attention to the new number? In the former case, should we also replace the old number with something indicating that we don't have the number yet?

@RHo -- pinging you on the above question.

Is the goal here to animate the icon while the search is running in the background, or to animate it for a short time once the results have been updated, to draw attention to the new number? In the former case, should we also replace the old number with something indicating that we don't have the number yet?

Hi, it is both, and I had it show --- when the number was updating in one of the usertesting prototypes, but an ellipsis ... would look better if it is possible to show that when the number is not yet shown.

count updates.mov.gif (932×876 px, 109 KB)
open to see animated gif (also note that the broadcast icon is not animated but it should be)

De-prioritizing off the sprint board in favor of other priorities.

kostajh added a subscriber: mepps.

Per chat yesterday, @mepps will work on this.

I have my local environment working for this. I've begun looking at the code.
Basically, I'm looking to be able to animate it at the start of the search (and change the number to ellipsis), then return it to still at the end. ArticleCountWidget.setCount seems to be mark the end of articles search. So far, it looks like the place to switch to the animated icon would be in updateMatchCount, but that function works differently across a couple different modules. StartEditingDialogue.updateMatchCount is so far where I've found the api called and now I'm checking if that covers all cases.

Yay! It looks like updateMatchCount is the correct function. Now I'll just need to deal with animated the icon and updating the number.

I've got the ellipsis in place during loading now. I'm having issues getting the animation to work with the svg and css above so I'm just trouble shooting that.

Hmm, so I'm noticing two things:

  • the oo.ui.js iconWidget generated link is trying to load format=rasterized which is not available
  • when it loads the svg correctly, it is tiny

The StartEditingDialog.updateMatchCount only applies to the initial search for articles. I'll need to apply this to the other dialogs. Kosta recommended using an api event potentially.

Today I kept experimenting with svg formatting and found that the display changes based on image format (tried a sprite and png converted) but neither actually uses the frames--they all just display the entire svg.

I also looked at how to update start and end search for the DifficultyFiltersDialog and TopicFiltersDialog. It looks like they both are called on FiltersDialog however, currently articleCounter is only available in the two unique classes. I'd like to roll up some of the shared logic but I'm exploring how much of excavation that is versus just keeping things as is. I'm also planning to change the function setCount in ArticleWidget to accept a "search" boolean parameter that would make the count "..." and animate the icon. When that is false, it will update the number and stop the animation.

Change 662759 had a related patch set uploaded (by Mepps; owner: Mepps):
[mediawiki/extensions/GrowthExperiments@master] Update count to '...' while searching for new articles

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

I may keep playing with the code structure but moving this on the workboard to reflect that I do have two patches up.

Change 662768 had a related patch set uploaded (by Mepps; owner: Mepps):
[mediawiki/extensions/GrowthExperiments@master] Animate live-broadcast icon on search

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

Change 663046 had a related patch set uploaded (by Mepps; owner: Mepps):
[mediawiki/extensions/GrowthExperiments@master] Create separate setSearching function to animate broadcast icon

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

While I have a working patch, I'm running into three issues:

  • I tried switching out '...' for mw.messages('ellipsis') but it's just showing up as blank. If I try to use .parse() or any of the other functions that are actually references to .toString() it just shows up as <<ellipsis>>.
  • @RHo Did you want the ellipsis with text or just an ellipsis? Either is doable but I realized I wasn't sure. As of now, I just have the ellipsis.
  • The main patch I have up modifies .setCount on ArticleWidget. However, ideally there'd be a new function setSearching. I tried creating this, but the issue is that for the second level filters, I need to update it in SuggestedEdits.js, but that doesn't have the ArticleCounter available to it. Only DifficultyDialog and TopicDialog have those and they are two separate objects in FiltersWidget. In an ideal world, I'd think the ArticleCounter logic would live in FilterWidget but I'm not sure how much re-writing to do right now since I'm new to this code base.

I have two patches up now that work and address the previous code review.

Hi @mepps - do you mean ellipsis using three dots ... or as the unicode symbol (U+2026)? If so, I would prefer the single character unicode symbol. Thanks!

While I have a working patch, I'm running into three issues:

  • I tried switching out '...' for mw.messages('ellipsis') but it's just showing up as blank. If I try to use .parse() or any of the other functions that are actually references to .toString() it just shows up as <<ellipsis>>.
  • @RHo Did you want the ellipsis with text or just an ellipsis? Either is doable but I realized I wasn't sure. As of now, I just have the ellipsis.
  • The main patch I have up modifies .setCount on ArticleWidget. However, ideally there'd be a new function setSearching. I tried creating this, but the issue is that for the second level filters, I need to update it in SuggestedEdits.js, but that doesn't have the ArticleCounter available to it. Only DifficultyDialog and TopicDialog have those and they are two separate objects in FiltersWidget. In an ideal world, I'd think the ArticleCounter logic would live in FilterWidget but I'm not sure how much re-writing to do right now since I'm new to this code base.

@RHo It's currently being translated by mw.messages( 'ellipsis' ). Would you think hardcoding the unicode would be better?

@RHo It's currently being translated by mw.messages( 'ellipsis' ). Would you think hardcoding the unicode would be better?

FWIW I think we would want to stick with the ellipsis mediawiki message, because it is rendered differently in different language contexts (e.g. ……, ..., are all different translations of this message).

@RHo It's currently being translated by mw.messages( 'ellipsis' ). Would you think hardcoding the unicode would be better?

FWIW I think we would want to stick with the ellipsis mediawiki message, because it is rendered differently in different language contexts (e.g. ……, ..., are all different translations of this message).

Ah gotcha, I didn't realise there is a specific MediaWiki message for ellipsis with translations already. Happy to go with that, but thanks for checking with me!

Change 663046 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] Animate live-broadcast icon, count on search

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

Change 662768 abandoned by Mepps:
[mediawiki/extensions/GrowthExperiments@master] Animate live-broadcast icon, count on search

Reason:
Squashed into another commit

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

for @RHo review. The screenshots are animated gifs - click to see the animation.
(1) Here is the current behavior in production (wmf.30) with network throttling (2G) - the counter shows up practically instantaneously.

Changing topic filterChanging difficulty level
SE_topic_anim.gif (671×504 px, 86 KB)
SE_difficulty_anim_prod.gif (671×504 px, 1 MB)

(2) betalabs - without network throttling

Changing topic filterChanging difficulty level
SE_topic_anim_beta.gif (671×504 px, 405 KB)
SE_dif_anim_beta.gif (581×504 px, 286 KB)

Note

  • the perceived performance - the time when the counter reflect the number of fetched results - is slower than in production. It might be specific to beta cluster, but I do not recall that it was the case before.

-I'll do cross-browser (and mobile) testing

Change 662759 abandoned by Mepps:
[mediawiki/extensions/GrowthExperiments@master] Update count to '...' while searching for new articles

Reason:
Squashed into another commit

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

Hi @mepps - thanks for the making the animated icon dream a reality! The animated gifs from @Etonkovidova look good, but I had one small clarification that was not clear in the task description, which is that it should be not only changing to the ellipsis, but showing ... articles found. Is that a relatively easy fix?

Yes @RHo! That is. It was actually what I was trying to ask about earlier but I'm not sure I was clear :).

Change 665158 had a related patch set uploaded (by Mepps; owner: Mepps):
[mediawiki/extensions/GrowthExperiments@master] ArticleCountWidget: Include full message with ellipsis when searching

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

Change 665158 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] ArticleCountWidget: Include full message with ellipsis when searching

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

For @RHo review - the animated gifs are from betalabs (please disregard temporary deficiencies, e.g. double labels and zero results) and testwiki wmf.32 for comparison.

testwiki wmf.32betalabs
testwiki_result_broadcastIcon.gif (529×490 px, 70 KB)
betalabs_result_broadcastIcon.gif (563×487 px, 179 KB)

betalabs - with throttling

large_betalabs_result_broadcastIcon.gif (701×621 px, 125 KB)

Super, thanks @mepps for the changes and @Etonkovidova for updated gifs. LGTM