focus-android icon indicating copy to clipboard operation
focus-android copied to clipboard

Undo erase while snackbar is showing

Open pocmo opened this issue 9 years ago • 22 comments

Added by @bbinto

Why/User Benefit

  • Provide a way for user to revert / undo if they hit accidentally on Erase

What

  • Include an "Undo" action after Erase button was hit

Acceptance Criteria (how do I know when I’m done?)

  • Undo action can be performed and indeed brings you back to previously visited website
  • Probe added to track when user hits undo action

Theme: General Improvement

User Story

As a user I want to revert / undo if I hit accidentally on Erase

Background

It just happened that I accidentally erase my browsing session. With no history this can be annoying because I need to get back to the app I came from and click the link again.

We are showing a snackbar once the user erases a browsing session. On Android those snackbars often contain an "undo" action. It would be nice if I could get back to the last URL as long as the snackbar is showing.

Tasks

  • [ ] Define scope: Do we just want to reload the last website? Or do we want to restore the last state (history, forms, scroll state)?
  • [ ] Add "undo" action to snackbar and implement undo based on scope.
  • [ ] UX / animation
  • [ ] Add telemetry probe

pocmo avatar Apr 13 '17 18:04 pocmo

In theory it's super easy: Keep the fragment around and if the user pressed undo then re-attach it. However I am running into issues with the animations not working correctly and Android re-creating the views without restoring the state.

pocmo avatar Apr 20 '17 12:04 pocmo

With the new back button behavior this might be less a concern: Instead of always erasing when going back we now go back to the previous app and the session will not be erased (but we show a notification!)

pocmo avatar Apr 24 '17 12:04 pocmo

@brampitoyo -- can you provide some first UX ideas around this?

bbinto avatar Apr 13 '18 17:04 bbinto

Animation-wise, it’s easy: when you undo the Erase action, we will also “undo” (reverse) the delete animation.

Our current Erase animation choreography looks like this:

  1. Erase button disappears
  2. Last opened webpage becomes more transparent, then slides down
  3. Firefox Focus logo and keyboard slides up
  4. Toast slides up

What would it look like if we “undo” (reverse) it?

  1. Toast slides down
  2. Firefox Focus logo and keyboard slides down
  3. Last opened webpage slides up, then becomes more opaque
  4. While the Erase button slides up (it doesn’t simply appear – @ekager had designed this effect for a separate issue)

droid_focus_undo_erase

Have a look at this slo-mo video for a breakdown of what elements move at what time.

If there are multiple tabs open, the Tab List button can slide up just like to the Erase button.

brampitoyo avatar Apr 16 '18 04:04 brampitoyo

In terms of UX, we should opt for the most restorative action possible. Instead of just reloading the last website, we should restore the last state.

brampitoyo avatar Apr 16 '18 04:04 brampitoyo

Can I work on this issue?

shikhart98 avatar Apr 16 '18 04:04 shikhart98

@brampitoyo There's one technical constraint here (maybe, depends on the implementation): We may need to reload/restore some things to get back to the session - meaning we won't have a rendered version of the website immediately available when restoring the tab. So the animation may not look as nice as in your mock. :)

Can I work on this issue?

This is not part of a milestone yet - and potentially a rather complex issue. I suggest picking something from the list of "help wanted" issues. We also have a bunch of things to work on in our android-components repository - if this is interesting to you: https://github.com/mozilla-mobile/android-components/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22

pocmo avatar Apr 16 '18 08:04 pocmo

@pocmo wrote:

[…] we won't have a rendered version of the website immediately available when restoring the tab.

I’d be okay if the restored tab shows only a white background and a loading indicator – as long as the URL bar shows the correct URL.

So the animation effect is no longer ‘unfreeze’ (e.g. like a restored VM), but more like ”here’s your last opened site, wait a bit for it to load”.

brampitoyo avatar Apr 16 '18 23:04 brampitoyo

Can't estimate yet, needs a breakdown.

Sdaswani avatar May 18 '18 17:05 Sdaswani

@bbinto when should we spend the time doing a breakdown?

Sdaswani avatar May 18 '18 17:05 Sdaswani

@brampitoyo I was just wondering: How does this work with multiple tabs? Do we restore all of them? Can you undo closing a single tab via back button?

pocmo avatar May 18 '18 17:05 pocmo

@Sdaswani - We should probably chat with the team how much time we need to allocate roughly for issues that need to be broken down (see upcoming retro).

My general gut feeling is that the feature/issue is not that urgent (over other features), so I can hold off on that until we have a plan how to do breakdowns.

bbinto avatar May 22 '18 11:05 bbinto

@bbinto i think most breakdowns are probably a S (.5 to 1 day of work).

Sdaswani avatar May 22 '18 13:05 Sdaswani

Breakdown should happen for 6.0 sprint (no real urgency)

bbinto avatar May 23 '18 14:05 bbinto

@pocmo wrote:

@brampitoyo I was just wondering: How does this work with multiple tabs? Do we restore all of them? Can you undo closing a single tab via back button?

We should restore all the tabs in the session that was just deleted – restoring as much as possible, essentially.

I don’t think the back button should be used for an “Undo” action. If the user doesn’t click “Undo”, then the Back button would just quit the app (rather than restore the previous session).

brampitoyo avatar May 29 '18 00:05 brampitoyo

Oh, sorry, what I meant was:

  • Open a website (tab A)
  • Open a new tab by long-pressing a link (tab B)
  • Click back button
  • -> We close the tab A and you are back in tab B.

Is this something we would want to allow to undo too?

pocmo avatar May 29 '18 14:05 pocmo

@pocmo Right. When a tab is closed via a back action, should we show a snackbar that says “Tab closed”, and then allow the user to undo it?

I think that this isn’t necessary, actually. What do you think?

brampitoyo avatar May 29 '18 22:05 brampitoyo

I think that this isn’t necessary, actually. What do you think?

Yeah, I'm okay with that decision. I just wanted to make sure we are explicit about that. :)

pocmo avatar May 30 '18 09:05 pocmo

  • [ ] Add "undo" action to snackbar
  • [ ] Implement undo based on scope.
  • [ ] UX / animation for "reverse" action detailed here
  • [ ] Add telemetry probe for undo action

boek avatar Jun 15 '18 17:06 boek

@bbinto Are you working on this? If not then I would like to work on this. Thanks

shashvat-kedia avatar Nov 12 '18 18:11 shashvat-kedia