Closed Bug 1157526 Opened 5 years ago Closed 4 years ago

Replace super toasts with snackbar

Categories

(Firefox for Android :: General, defect)

All
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 45
Tracking Status
firefox45 --- fixed
relnote-firefox --- 45+

People

(Reporter: mhaigh, Assigned: sebastian)

References

(Depends on 3 open bugs, Blocks 2 open bugs)

Details

(Keywords: dev-doc-needed)

Attachments

(7 files)

According to the docs [1] "Toasts are similar to snackbars but _do not contain actions_ ...".  We should remove our super toasts and replace them with snackbars [1] to ensure parity.


1: http://www.google.com/design/spec/components/snackbars-toasts.html#
Mr. Cranky Pants says "I'd rather get some of our stability work and glaring polish work underway, and delay this change for a while."
^ I'd agree, especially due to snack bar support for non-L versions. 

Maybe this is something we can do for just L versions? would that be easier?
^ Although, even then - I can see a lot of cases in our UI that this might be more finicky in than anticipated.
(In reply to Anthony Lam (:antlam) from comment #2)
> ^ I'd agree, especially due to snack bar support for non-L versions. 

Or any versions! Apparently there is no official API yet [1] so maybe we should hold out for the (presumably to-be-released) Google API.

[1]: https://stackoverflow.com/questions/25633695/is-there-code-for-snackbars-in-android-l-or-are-we-expected-to-implement-them-ou
Assignee: mhaigh → nobody
Any chance we can get this back up for consideration? With the changes to the tabs tray, the current toasts are now blocking content. This is something we wouldn't have to worry about if we used the suggested SnackBar experience since they hug the bottom of the screen. Meaning that if a user is swiping away a few tabs, the perception of the blocked area is significantly smaller.

Plus we now have backwards compatibility thanks to the Android Design Support Library: http://developer.android.com/tools/support-library/features.html#design
(In reply to Paul [pwd] from comment #5)
> Plus we now have backwards compatibility thanks to the Android Design
> Support Library:
> http://developer.android.com/tools/support-library/features.html#design

Note: there are some concerns about how this might grow our APK size (see bug 1189306). But presumably we'll need to add it eventually...
Depends on: 1189306
Should we re-prioritize this? It would help with issues like bug 1204760.
Flags: needinfo?(bbermes)
Flags: needinfo?(alam)
How much engineering effort is this? I'd love to progress all our toasts to snack bars. I think this would move us a huge step closer to being more updated/polished.
Flags: needinfo?(alam)
(In reply to Anthony Lam (:antlam) from comment #8)
> How much engineering effort is this? I'd love to progress all our toasts to
> snack bars. I think this would move us a huge step closer to being more
> updated/polished.

The SnackBar API is simple so provided we have them draw over other views, it seems easy. I think some apps scroll the app content to get it out of the way of the SnackBar – that'd be much more difficult.
Looking at our roadmap, we are packed for 44...maybe something for 45?

(In reply to Paul [pwd] from comment #5)
> Any chance we can get this back up for consideration? With the changes to
> the tabs tray, the current toasts are now blocking content. 
Not sure if I understand the issue here. Do we have a screenshot?
Flags: needinfo?(bbermes)
I really want this to happen.  I'm noting it dev-doc-needed because I think https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/NativeWindow/toast will need to be updated.
Keywords: dev-doc-needed
See Also: → 1212763
(In reply to Nick Alexander :nalexander from comment #12)
> I really want this to happen.  I'm noting it dev-doc-needed because I think
> https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/
> NativeWindow/toast will need to be updated.

Would we change the API for add-ons? Or do you just mean talking about the fact that the UI representation is now different?
I'd also like to see bug 1052276 impl'd too.
(In reply to Mark Finkle (:mfinkle) from comment #15)
> (In reply to Nick Alexander :nalexander from comment #12)
> > I really want this to happen.  I'm noting it dev-doc-needed because I think
> > https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/
> > NativeWindow/toast will need to be updated.
> 
> Would we change the API for add-ons? Or do you just mean talking about the
> fact that the UI representation is now different?

I think we would change the API for add-ons, since the UI guidelines more or less forbid icons: "Snackbars should contain a single line of text directly related to the operation performed. They may contain a text action. They cannot contain icons."  (From http://www.google.com/design/spec/components/snackbars-toasts.html#snackbars-toasts-usage.)
(In reply to Michael Comella (:mcomella) from comment #11)
> Created attachment 8669724 [details]
> Toast blocks tabs tray example

Thanks mcomella - not really sure if I get this here --> the toast will disappear though after a while, wouldn't the snackbar cover some of the tabs tray as well (even if it's docked)?

Just trying to understand the urgency here and to prioritize. I understand Anthony wants to polish things but we need to understand effort etc.
Flags: needinfo?(bbermes)
(In reply to Barbara Bermes [:barbara] from comment #18)
> Thanks mcomella - not really sure if I get this here --> the toast will
> disappear though after a while, wouldn't the snackbar cover some of the tabs
> tray as well (even if it's docked)?

Yes – our current toast is more inconvenient though (i.e. covers the center of the tabs), which is probably a reason why Android is moving away from toasts and towards SnackBars.
Flags: needinfo?(bbermes)
Alright, thanks Mike.

I created an Aha card to discuss priority in our funnel meeting: https://mozilla.aha.io/features/FENN-350

Thanks
Flags: needinfo?(bbermes)
(In reply to Michael Comella (:mcomella) from comment #19)
> (In reply to Barbara Bermes [:barbara] from comment #18)
> > Thanks mcomella - not really sure if I get this here --> the toast will
> > disappear though after a while, wouldn't the snackbar cover some of the tabs
> > tray as well (even if it's docked)?
> 
> Yes – our current toast is more inconvenient though (i.e. covers the center
> of the tabs), which is probably a reason why Android is moving away from
> toasts and towards SnackBars.

Additionally a snackbar supports swipe-to-dismiss if used in conjunction with a CoordinatorLayout.
Depends on: 1215026
No longer blocks: 1204760
Depends on: 1204760
I noticed that for adding a bookmark, we still use toasts - is there a bug for that?
(In reply to Chenxia Liu [:liuche] from comment #22)
> I noticed that for adding a bookmark, we still use toasts - is there a bug
> for that?

I only migrated the "closed tab" toast for now. I'm planning on changing all other toasts here later.
(In reply to Sebastian Kaspari (:sebastian) from comment #23)
> (In reply to Chenxia Liu [:liuche] from comment #22)
> > I noticed that for adding a bookmark, we still use toasts - is there a bug
> > for that?
> 
> I only migrated the "closed tab" toast for now. I'm planning on changing all
> other toasts here later.

We could file mentor bugs for the remaining button toasts. It would actually be pretty nice if we can remove our custom ButtonToast implementation (and deprecate the add-on API for buttons in toasts).
Depends on: 1223048
Bug 1157526 - (Part 1) Replace "New tab" toast with snackbar. r?mcomella
Attachment #8686689 - Flags: review?(michael.l.comella)
Bug 1157526 - (Part 2) Replace "New private tab" toast with snackbar. r?mcomella
Attachment #8686690 - Flags: review?(michael.l.comella)
Bug 1157526 - (Part 3) Replace "Image unblocked" toast with snackbar. r?mcomella
Attachment #8686691 - Flags: review?(michael.l.comella)
Bug 1157526 - (Part 4) Replace "Add-on installed" toast with snackbar. r?mcomella
Attachment #8686692 - Flags: review?(michael.l.comella)
Bug 1157526 - (Part 5) Remove unused toast method. r?mcomella
Attachment #8686693 - Flags: review?(michael.l.comella)
Bug 1157526 - (Part 6) Replace "Already signed in" toast with snackbar. r?mcomella
Attachment #8686694 - Flags: review?(michael.l.comella)
This series of patches replaces all button toasts with snackbars. This is enough to let us deprecate adding buttons to toast via the API.

Note: Some toasts used "short" durations previously and are now using "long" as a snackbar. The snackbar dismissed just too fast to read the text and press the button (Long = 2750ms, Short = 1500ms). I feel like "short" is more suitable for feedback snackbars without buttons.

We have bug 1216051 filed for thinking about deprecating toasts. After those patches I'd at least deprecate the button part - because that's custom non-Android stuff. Developers can now use the Snackbar API for that.

I'll also file a bug about the remaining (non-button) toasts. I feel like some of them make sense. For example non-important feedback toasts (e.g. "Printing..."). A snackbar could be too disruptive. But that's something to discuss with antlam in the new bug.
Assignee: nobody → s.kaspari
Status: NEW → ASSIGNED
Comment on attachment 8686689 [details]
MozReview Request: Bug 1157526 - (Part 1) Replace "New tab" toast with snackbar. r?mcomella

https://reviewboard.mozilla.org/r/25025/#review22607
Attachment #8686689 - Flags: review?(michael.l.comella) → review+
Attachment #8686690 - Flags: review?(michael.l.comella) → review+
Comment on attachment 8686690 [details]
MozReview Request: Bug 1157526 - (Part 2) Replace "New private tab" toast with snackbar. r?mcomella

https://reviewboard.mozilla.org/r/25027/#review22609
Comment on attachment 8686691 [details]
MozReview Request: Bug 1157526 - (Part 3) Replace "Image unblocked" toast with snackbar. r?mcomella

https://reviewboard.mozilla.org/r/25029/#review22611
Attachment #8686691 - Flags: review?(michael.l.comella) → review+
Comment on attachment 8686692 [details]
MozReview Request: Bug 1157526 - (Part 4) Replace "Add-on installed" toast with snackbar. r?mcomella

https://reviewboard.mozilla.org/r/25031/#review22613

::: mobile/android/tests/browser/robocop/roboextender/base/robocop_prompt_gridinput.html:34
(Diff revision 1)
> -      { iconUri: "drawable://alert_addon", name: "Icon 11" },
> +      { iconUri: "drawable://icon", name: "Icon 11" },

Without digging deeper, I'm unsure this will pass but if it passes for you, wfm.
Attachment #8686692 - Flags: review?(michael.l.comella) → review+
Comment on attachment 8686693 [details]
MozReview Request: Bug 1157526 - (Part 5) Remove unused toast method. r?mcomella

https://reviewboard.mozilla.org/r/25033/#review22615
Attachment #8686693 - Flags: review?(michael.l.comella) → review+
Attachment #8686694 - Flags: review?(michael.l.comella) → review+
Comment on attachment 8686694 [details]
MozReview Request: Bug 1157526 - (Part 6) Replace "Already signed in" toast with snackbar. r?mcomella

https://reviewboard.mozilla.org/r/25035/#review22617

Snackbars? [Give me a break!](https://www.youtube.com/watch?v=0nkcVz1mad0) ;)
(In reply to Michael Comella (:mcomella) from comment #35)
> Without digging deeper, I'm unsure this will pass but if it passes for you,
> wfm.

Yeah, it passed locally. But I'm now going to push everything to try.
https://hg.mozilla.org/integration/fx-team/rev/4b30e5c0a1cd51dace28bf9939b8fbd9263de3df
Bug 1157526 - (Part 1) Replace "New tab" toast with snackbar. r=mcomella

https://hg.mozilla.org/integration/fx-team/rev/2cac2e4b0215cd3eb0f2e184b4d5d107a29b5e4a
Bug 1157526 - (Part 2) Replace "New private tab" toast with snackbar. r=mcomella

https://hg.mozilla.org/integration/fx-team/rev/8b14ccf741bbc4f8f7fd1f639c301e82fb3e1fdd
Bug 1157526 - (Part 3) Replace "Image unblocked" toast with snackbar. r=mcomella

https://hg.mozilla.org/integration/fx-team/rev/fa6c456d5640a02966186277402295c58e90e7c9
Bug 1157526 - (Part 4) Replace "Add-on installed" toast with snackbar. r=mcomella

https://hg.mozilla.org/integration/fx-team/rev/a0d08563a76e53b393b81d73538e43e6591b3797
Bug 1157526 - (Part 5) Remove unused toast method. r=mcomella

https://hg.mozilla.org/integration/fx-team/rev/68df6df19968bf7015ace65985e63a577a7d4725
Bug 1157526 - (Part 6) Replace "Already signed in" toast with snackbar. r=mcomella
Depends on: 1216051
Depends on: 1224521
Depends on: 1224523
Depends on: 1224530
Is it expected that going to the grid view in top sites and long tap on a page and choosing "Open in New Tab" / "Open in Private Tab", will not display a snackbar? If you long tap on a link from news.google.com and choose "Open Link in New Tab" / "Open Link in Private Tab" a snackbar will be displayed.
The same message is displayed on both toasts: "New tab opened | Switch"
(In reply to Teodora Vermesan (:TeoVermesan) from comment #42)
> Is it expected that going to the grid view in top sites and long tap on a
> page and choosing "Open in New Tab" / "Open in Private Tab", will not
> display a snackbar? If you long tap on a link from news.google.com and
> choose "Open Link in New Tab" / "Open Link in Private Tab" a snackbar will
> be displayed.
> The same message is displayed on both toasts: "New tab opened | Switch"

This has been fixed in bug 1224530. :)
Depends on: 1228414
Depends on: 1231655
Depends on: 1233440
Depends on: 1233465
Depends on: 1233467
As far as I can tell, the only docs update needed here is to add a deprecation notice to https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/NativeWindow/toast/show, pointing people at https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/Snackbars.jsm, but please let me know if I am wrong.
Flags: needinfo?(s.kaspari)
(In reply to Will Bamberg [:wbamberg] from comment #44)
> As far as I can tell, the only docs update needed here is to add a
> deprecation notice to
> https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/
> NativeWindow/toast/show, pointing people at
> https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/
> Snackbars.jsm, but please let me know if I am wrong.

Yeah, that's correct. Alex Johnson did a great job documenting Snackbars.jsm on MDN and adding deprecation warnings.
Flags: needinfo?(s.kaspari)
Depends on: 1234148
Depends on: 1234295
Depends on: 1237538
Depends on: 1239146
Release Note Request (optional, but appreciated)
[Why is this notable]:
[Suggested wording]: Replace super toasts with snackbar
[Links (documentation, blog post, etc)]:
relnote-firefox: --- → ?
Added to the release notes with "Replace super toasts with snackbar" as wording
With a link pointing to http://www.google.com/design/spec/components/snackbars-toasts.html
Depends on: 1246707
Depends on: 1254983
See Also: → 1260143
You need to log in before you can comment on or make changes to this bug.