Closed Bug 1233467 Opened 4 years ago Closed 4 years ago

Dismiss snackbar when user taps outside

Categories

(Firefox for Android :: General, defect)

35 Branch
defect
Not set

Tracking

()

VERIFIED FIXED
Firefox 46
Tracking Status
firefox45 --- verified
firefox46 --- verified
fennec 45+ ---

People

(Reporter: Margaret, Assigned: sebastian)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Right now the user has to wait for the timeout for the snackbar to go away. Let's make it go away as soon as they start interacting with other parts of the UI, the way our button toasts used to behave.
See Also: → 1226874
Assignee: nobody → s.kaspari
Status: NEW → ASSIGNED
Comment on attachment 8700043 [details]
MozReview Request: Bug 1233467 - Dismiss snackbar when user taps outside. r?mcomella

https://reviewboard.mozilla.org/r/28529/#review25603

::: mobile/android/base/java/org/mozilla/gecko/BrowserApp.java:2683
(Diff revision 1)
>      private class HideOnTouchListener implements TouchEventInterceptor {

It looks like this listener occurs on `R.id.main_layout` but there are a few views which do not fall inside of it – `R.id.tabs_panel` and `R.id.tab_history_panel`. Have you tested to ensure SnackBars are dismissable in this fashion when clicking on these views? It's possible the touch events fall through.
Attachment #8700043 - Flags: review?(michael.l.comella) → review+
(In reply to Michael Comella (:mcomella) from comment #2)
> It looks like this listener occurs on `R.id.main_layout` but there are a few
> views which do not fall inside of it – `R.id.tabs_panel` and
> `R.id.tab_history_panel`. Have you tested to ensure SnackBars are
> dismissable in this fashion when clicking on these views? It's possible the
> touch events fall through.

Yeah, it still works in the tabs panel: The view is not a child of the main layout but the touch event will still be received by main layout because it fills the whole screen. onInterceptTouchEvent() will be called before any other view can handle the touch event in onTouch().
https://hg.mozilla.org/mozilla-central/rev/c0780b68dfcc
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 46
Let's see if we can uplift this to go with the rest of the snackbar changes in 45.
tracking-fennec: --- → 45+
NI to request uplift
Flags: needinfo?(s.kaspari)
Comment on attachment 8700043 [details]
MozReview Request: Bug 1233467 - Dismiss snackbar when user taps outside. r?mcomella

Approval Request Comment

[Feature/regressing bug #]: Snackbars have been introduced app-wide in Firefox 45. See bug 1157526 and follow-ups.

[User impact if declined]: In some situations a snackbar covers content inconveniently. Up to now there has been no way to dismiss a snackbar and you had to wait for the timeout (~2-3 seconds). With this patch the snackbar is automatically dismissed if the user taps anywhere else.

[Describe test coverage new/current, TreeHerder]: Manual testing.

[Risks and why]: Low. Code already existed for handling toasts. I just added the call to dismiss the snackbar to this code.

[String/UUID change made/needed]:
Flags: needinfo?(s.kaspari)
Attachment #8700043 - Flags: approval-mozilla-aurora?
Tested using:
Device: Nexus 7 (Android 5.1.1)
Build: Firefox for Android 46.0a1 (2016-01-06)

Snackbar is not dismissed when the user taps outside in these cases:
- bookmark is updated 
- page is removed from home panels 

Snackbar is dismissed when the user taps outside in these cases:
- choosing to open a page in "Open in New Tab" / "Open in Private Tab" 
- downloading/installing an add-on 
- adding/removing a page to reading list 
- unblocking image 
- adding/removing a bookmark 
- a text is copied 
- a download begins 
- a page is printed 
- a search engine is added 
- a link is bookmarked
- an already bookmark is added as bookmark
(In reply to Teodora Vermesan (:TeoVermesan) from comment #9)
> Tested using:
> Device: Nexus 7 (Android 5.1.1)
> Build: Firefox for Android 46.0a1 (2016-01-06)
> 
> Snackbar is not dismissed when the user taps outside in these cases:
> - bookmark is updated 
> - page is removed from home panels 

This should be fixed after fixing the root cause in bug 1234295 (Some snackbars are created independently from BrowserApp and therefore the code in BrowserApp can't dismiss them).
Comment on attachment 8700043 [details]
MozReview Request: Bug 1233467 - Dismiss snackbar when user taps outside. r?mcomella

Polish, taking it.
Attachment #8700043 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Snackbars are dismissed when the user taps outside, so:
Verified as fixed using:
Device: One A2001 (Android 5.1.1) 
Build: Firefox for Android 46.0a2 (2016-02-16)
Snackbars are dismissed when the user taps outside, so:
Verified as fixed using:
Device: Nexus 6 (Android 6.0)
Build: Firefox for Android 45.0b9 build 2
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.