Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Swipe left/right on site to go backward/forward in tab history #12327

Closed
1 task
person808 opened this issue Jul 6, 2020 · 18 comments
Closed
1 task

Swipe left/right on site to go backward/forward in tab history #12327

person808 opened this issue Jul 6, 2020 · 18 comments
Assignees
Labels
eng:ready Ready for engineering Feature:Gesture feature request 🌟 New functionality and improvements

Comments

@person808
Copy link
Contributor

person808 commented Jul 6, 2020

Edit: Roadmap for what needs to be done

  • Needs GeckoView work (likely would have the same issues as pull-to-refresh if implemented now)
    • If Android provides 2-button or 3-button navigation, only then should we implement our own custom swipe-to-navigate

Broken out from #176

What is the user problem or growth opportunity you want to see solved?

There is no gesture to go back and forward in a tab's history. Going back requires pressing the back button and going forward requires opening the three dot menu.

One solution is to add a gesture to swipe left/right on a site to navigate backward/forward in tab history.

How do you know that this problem exists today? Why is this important?

Currently, going back and forward in a tab's history requires moving your finger down to the toolbar or navigation bar. Android 10 gestures reduce the movement for going back, but not everyone has gesture navigation enabled.

IIRC, Safari on iOS has this gesture. Desktop browsers often allow a two-finger swipe on a touchpad to perform these actions.

Firefox on Mac:

Who will benefit from it?

People who use gestures to navigate, especially on larger devices.

┆Issue is synchronized with this Jira Task

@github-actions github-actions bot added the needs:triage Issue needs triage label Jul 6, 2020
@lime124 lime124 mentioned this issue Jul 6, 2020
18 tasks
@person808 person808 removed the needs:triage Issue needs triage label Jul 6, 2020
@person808
Copy link
Contributor Author

Some considerations:

  1. Do we want to show a preview of the previous/next page for the gesture (I think safari does this)? Or do we want to show an indicator like the desktop screenshot above? Showing a preview is likely much more work and probably would require A-C work as well.
  2. Should we allow swipe to go back to the home page? My gut instinct is no as there's no easy way to implement swipe to go forward from the home page.
  3. In [Spike] Holding back does not show tab stack history #1048, @brampitoyo proposed using a swipe and hold gesture to show the tab history backstack. If we want to do that we should make sure it plays well with this gesture. In my opinion, if we implement both gestures, showing an arrow indicator for this gesture make more sense than showing a preview of the previous/next page. Having a preview, then hiding it to show the tab history is a much more jarring animation than hiding an arrow.
    Chrome has an experimental setting (chrome://flags/#overscroll-history-navigation) that implements this behavior.
  4. The spec for Switch Tabs via Swiping Address Bar #3481 specifies switching gesture direction for RTL layouts. Is that something we want to do here as well?

@person808
Copy link
Contributor Author

person808 commented Jul 6, 2020

This is what chrome's gesture looks like after setting chrome://flags/#overscroll-history-navigation to "Enabled Navigation Sheet": https://streamable.com/uljnbl

Chrome's gesture only triggers when swiping from the edge of the screen so it doesn't work with Android 10 gestures. I wonder why they restrict it to the edge of the screen 🤔

@boek
Copy link
Contributor

boek commented Jul 6, 2020

would we be able to get this to work with gesture based navigation?

@person808
Copy link
Contributor Author

I think if we expose an API in EngineView to detect if a page can scroll horizontally then its possible. I think GeckoView already provides the necessary info, it just needs to be exposed in A-C. My biggest concern is that we end up running into the same issues as pull-to-refresh since that uses similar APIs.

From the Fenix side, #12174 implements the code that would allow us to intercept swipes from anywhere. So it should be doable if everything goes right on the A-C side and I can get the touch events to propagate correctly.

@brampitoyo
Copy link

@person808 @boek One of my concerns about adding this gesture is the potential conflict with Android 10’s indiscriminate back gesture.

As far as I’m aware, Chrome elects not to do swipe-to-navigate if the system already does gesture navigation, providing only a forward button in the main menu.

My recommendation is the same: if Android provides gesture navigation, let’s not implement our own swipe. Except there are a few additions:

  • When the forward button (inside the main menu) is long-pressed, show history stack
  • When user swipes from the left/right edge (provided by Android) and hold, show history stack

On the other hand, if Android provides 2-button or 3-button navigation, only then should we implement our own custom swipe-to-navigate. The same additions are also present here:

  • When the forward button (inside the main menu) is long-pressed, show history stack
  • When the back button (provided by Android) is long-pressed, show history stack

Does this behaviour sound sensible to you?

If it is, then we can design a UI for it – I think Chrome’s is a good starting point, but we already have a pull-to-refresh, and can use the same circle size/background for this history navigation.

@brampitoyo brampitoyo self-assigned this Jul 7, 2020
@Dunexus
Copy link

Dunexus commented Jul 7, 2020

This behavior is really consistent between gesture and button navigation but also with desktop. 👍

Is it possible to use Android 10's gesture navigation and receive the "hold" event or do you have to handle it inside Fenix using custom UI and disable the back gesture provided by Android 10 ?

@person808 person808 self-assigned this Jul 7, 2020
@person808
Copy link
Contributor Author

person808 commented Jul 7, 2020

@brampitoyo In general, that makes sense to me. I have some eng concerns with swipe-to-navigate and the history stack. I'll focus on the swipe-to-navigate gesture here and keep everything related to the history stack in #1048.

For swiping to go forward/back when system gestures are disabled, I think we should hold off on implementing this until pull-to-refresh is fixed. The fixes for pull-to-refresh from GeckoView will likely enable this gesture to be implemented. So this issue is blocked by GeckoView.

@echeoquehaii
Copy link

Some considerations:

1. Do we want to show a preview of the previous/next page for the gesture (I think safari does this)? Or do we want to show an indicator like the desktop screenshot above? Showing a preview is likely much more work and probably would require A-C work as well.

2. Should we allow swipe to go back to the home page? My gut instinct is no as there's no easy way to implement swipe to go forward from the home page.

3. In #1048, @brampitoyo proposed using a swipe and hold gesture to show the tab history backstack. If we want to do that we should make sure it plays well with this gesture. In my opinion, if we implement both gestures, showing an arrow indicator for this gesture make more sense than showing a preview of the previous/next page. Having a preview, then  hiding it to show the tab history is a much more jarring animation than hiding an arrow.
   Chrome has an experimental setting (chrome://flags/#overscroll-history-navigation) that implements this behavior.

4. The spec for #3481 specifies switching gesture direction for RTL layouts. Is that something we want to do here as well?

To me the "Safari style" with previews is the best implementation, with a pixel by pixel gesture. This would also allow to peak at the previus (or next) webpage in history in case of need, without actually going back and forward. It also gives a more natural and coutinous feeling for the browsing experience.
It's indeed true, as you said, that it would mean much more work and probably load for the phone, and the issue with the tab history. So if this considerations are true I would say it's also ok to go for the arrow style.

Either way I think it's very important for the gesture to be implemented. Not so many people are using Android 10, I would say it's a great minority, so very little people uses the Android built-in gestures and it would mean a great Plus Factor for Firefox in comparison to other browsers.

@person808 person808 removed the needs:UX-feedback Needs UX Feedback label Jul 13, 2020
@brampitoyo brampitoyo added the eng:ready Ready for engineering label Jul 16, 2020
@brampitoyo
Copy link

Thanks @person808. This issue is now ready for Engineering to work on.

I know that we’d only be able to test how this feature “feels” after the code has landed. Let me know when this happens. We can then test it and make sure that it feels just right.

@person808
Copy link
Contributor Author

Unassigning myself because I think that it is best to wait for the remaining pull-to-refresh issues to be fixed before we add another gesture that handles touch events over web pages. Unfortunately, its highly unlikely pull-to-refresh will be fixed before I have to return to school.

@person808 person808 removed their assignment Jul 24, 2020
@data-sync-user data-sync-user changed the title Swipe left/right on site to go backward/forward in tab history FNX3-15306 ⁃ Swipe left/right on site to go backward/forward in tab history Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX3-15306 ⁃ Swipe left/right on site to go backward/forward in tab history FNX-13372 ⁃ Swipe left/right on site to go backward/forward in tab history Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX-13372 ⁃ Swipe left/right on site to go backward/forward in tab history FNX2-15169 ⁃ Swipe left/right on site to go backward/forward in tab history Aug 11, 2020
@kbrosnan kbrosnan changed the title FNX2-15169 ⁃ Swipe left/right on site to go backward/forward in tab history Swipe left/right on site to go backward/forward in tab history Aug 29, 2020
@echeoquehaii
Copy link

I've noticed pull down to refresh has been added on nightly. Is development progressing on this one?

Thank you!

@stale
Copy link

stale bot commented May 5, 2021

See: #17373 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 5, 2021
@kbrosnan kbrosnan removed the wontfix label May 5, 2021
@kbrosnan kbrosnan added the feature request 🌟 New functionality and improvements label May 5, 2021
@iamkartk
Copy link

iamkartk commented Oct 4, 2021

dont know how many years will it take to firefox team to develop this feature

@echeoquehaii
Copy link

dont know how many years will it take to firefox team to develop this feature

Good question, I don't understand why it is not considered a priority

@iamkartk
Copy link

iamkartk commented Oct 5, 2021

dont know how many years will it take to firefox team to develop this feature

Good question, I don't understand why it is not considered a priority

There is also a request for text reflow posted in 2019, still not considered to implement.

@shawnz
Copy link

shawnz commented Dec 21, 2021

If Android provides 2-button or 3-button navigation, only then should we implement our own custom swipe-to-navigate

Even if the user has Android configured for gesture navigation, I think Firefox should still handle right swiping to go forward, since that is not natively supported.

@tesmite
Copy link

tesmite commented Aug 19, 2022

This gesture is already enabled in the stable versions of Brave, Chrome, Edge, and Vivaldi.
This gesture will only work in these browsers if gesture navigation is disabled in Android 10 or later (when using 2-button or 3-button navigation).
It would be desirable to implement the same method in Firefox, but is there any work in progress?

@csadilek
Copy link
Contributor

Moved to bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1807052

Change performed by the Move to Bugzilla add-on.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
eng:ready Ready for engineering Feature:Gesture feature request 🌟 New functionality and improvements
Projects
None yet
Development

No branches or pull requests

10 participants