New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 2 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature

Blocked on:
issue 921718



Sign in to add a comment
link

Issue 865567: Investigate enabling kOverscrollHistoryNavigation on Android

Reported by tedc...@chromium.org, Jul 19 2018 Project Member

Issue description

I find the kSimpleUi variant of the overscroll history navigation to be quite elegant on touch enabled Chrome clients, so I think it would be interesting to try porting it to Android and seeing how it feels.

+mohsen as the original author of the Aura version
+nickrad for Android PM awareness to not be scared of crazy things
+mdjones for the most awareness of our browser composited UI these days

Definitely P3, but just something I wanted to track.
 

Comment 1 by mdjones@chromium.org, Jul 19 2018

Some quick notes for future me:

overscroll_controller_android.cc:
OnOverscrolled() provides both x and y overscroll, we can probably add another handler for tab switching, similar to what the class OverscrollRefresh is doing.

Android appears to have a widget for overscroll refresh that we use (that overscroll events eventually get piped to), it doesn't look like there is such a thing for side-swiping, but that seems like it wouldn't be that hard to implement (the layout is simple enough).

Comment 2 by tedc...@chromium.org, Jul 19 2018

I wonder if we can reuse the aura UI for the side nav.  The existing Android refresh UI was implemented to be consistent with Android's pull to refresh, but no such concept exists for side swipe.

Comment 3 by tedc...@chromium.org, Nov 5

Owner: jinsuk...@chromium.org
Status: Assigned (was: Available)
Assigning to jinsukkim@ to see if we can make this a reality.

Here was my super hacky prototype for this:
https://chromium-review.googlesource.com/c/chromium/src/+/1249530

The problem is that it doesn't work on native pages like the NTP.  So, we will likely need to build a version that works across android widgets and composited UI.  We might want to always render in java, but maybe we can share the positioning and motion components with native.

Comment 4 by jinsuk...@chromium.org, Nov 5

Looks interesting! I guess HistoryNavLayout.java is missing in the CL...? It could be a good starting point so I want to understand how it was done.

Comment 5 by tedc...@chromium.org, Nov 5

I believe HistoryNavLayout is an inner class in the larger swipe java class, so I "think" it should all be in there.

Comment 6 by jinsuk...@chromium.org, Nov 5

Should've scrolled down further. Thanks!

Comment 7 by jinsuk...@chromium.org, Nov 13

Status: Started (was: Assigned)
> I wonder if we can reuse the aura UI for the side nav.  The existing Android refresh UI was implemented to be consistent with Android's pull to refresh, but no such concept exists for side swipe.

It would be more desirable if the drawable (circle with back/forward arrow for side nav) is designed with same look-and-feel as the one used for tap-to-refresh on Android, rather than aura UI. Its side/tap-to-refresh UI look consistent. I think Clank keep them consistent as well.

Found it is in third_party/android/swiperefresh/ Maybe the new drawable should be added there?

Comment 8 by tedc...@chromium.org, Nov 13

I personally think the refresh one is too small for edge navigations.  I think the aura one is prominent enough to notice.

My thinking was to keep it consistent with desktop for now and then let UX iterate on it, but at least they approved the Aura one at some point in the past.

I think UX would actually prefer showing snapshots of the previous/next page on these edge gestures, but I think that raises even more complexity.

I think we still have to go through the whole launch process based on this, but my thinking was to get something behind a flag to allow us to play around with.  It would be fine to go with whatever is easiest to start and we can add onto it as we get more UX guidance.

Comment 9 by jinsuk...@chromium.org, Nov 13

Point taken. Let me put together what works easiest for me to get it started working then.

Comment 10 by jinsuk...@chromium.org, Nov 27

WIP https://chromium-review.googlesource.com/c/chromium/src/+/1249530/5

Details in UI (dimensions, color) may be different from Aura but trying give it same look-and-feel.
gesture-navigation.mp4
5.7 MB View Download

Comment 11 by rbyers@chromium.org, Nov 27

Cc: rbyers@chromium.org majidvp@chromium.org nzolghadr@chromium.org
Components: Blink>Input
This has web platform implications, so please keep the input-dev team (/cc nzolghadr) in the loop on this.

I assume that, like for ChromeOS, 'overscroll-behavior:x contain' can be used by a site to preserve today's behavior, right? IMHO it's critical that (unlike Safari) we preserve Chrome's "content not chrome" philosophy of giving the web page primary control over how input over it's surface is handled.

Eg. For Google photos, user confusion about the effect of swiping forward/back is one of their top user complaints on iOS (since users generally can't distinguish between a swipe handled by the content, and one handled by the browser). I think chromium's approach is superior since it doesn't rely on the mere position of the swipe (near the edge or not) to change behavior, and allows sites to customize the behavior. But still, we can expect some amount of developer and user frustration whenever we change scroll behavior.

Comment 12 by jinsuk...@chromium.org, Nov 27

Thank Rick for your input. Yes Ted and I are aware of the issue you pointed out, and will make sure it is addressed (web page will have priority in handling the swipe event over the navigation).

Comment 13 by bugdroid1@chromium.org, Nov 28

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/459ee142e66050d41139f8d7f28ef3d9945bb98f

commit 459ee142e66050d41139f8d7f28ef3d9945bb98f
Author: Jinsuk Kim <jinsukkim@chromium.org>
Date: Wed Nov 28 06:27:31 2018

Android: Create a chrome://flags entry for gesture-nav

Creates a new entry in chrome://flags for gesture navigation
that will allow horizontal scroll gesture to navigate forward/backward.

Bug: 865567
Change-Id: Id35d8ad261e2f4a29e34c4b4a73eed04029ba643
Reviewed-on: https://chromium-review.googlesource.com/c/1350411
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611577}
[modify] https://crrev.com/459ee142e66050d41139f8d7f28ef3d9945bb98f/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
[modify] https://crrev.com/459ee142e66050d41139f8d7f28ef3d9945bb98f/chrome/browser/about_flags.cc
[modify] https://crrev.com/459ee142e66050d41139f8d7f28ef3d9945bb98f/chrome/browser/android/chrome_feature_list.cc
[modify] https://crrev.com/459ee142e66050d41139f8d7f28ef3d9945bb98f/chrome/browser/android/chrome_feature_list.h
[modify] https://crrev.com/459ee142e66050d41139f8d7f28ef3d9945bb98f/chrome/browser/flag-metadata.json
[modify] https://crrev.com/459ee142e66050d41139f8d7f28ef3d9945bb98f/chrome/browser/flag_descriptions.cc
[modify] https://crrev.com/459ee142e66050d41139f8d7f28ef3d9945bb98f/chrome/browser/flag_descriptions.h
[modify] https://crrev.com/459ee142e66050d41139f8d7f28ef3d9945bb98f/tools/metrics/histograms/enums.xml

Comment 14 by chem...@gmail.com, Nov 30

Just chiming in; wouldn't this break what Android users expect when they swipe from the left (an app drawer)?

I'll admit that I'm biased here because I have PWA's that use the "swipe in from left edge of screen" to show an app drawer on Android. Would hate if breaks because of this change.

Any chance that web developers can control whether this works through a Javascript call or meta tag or something?

Comment 15 by tedc...@chromium.org, Nov 30

I'll have to defer to rbyers@ for the best way for a PWA to disable this entirely, but the goal is to definitely defer to the site before we attempt to trigger any such accelerator.

For example, I don't see this ever working on google.com/maps because there is no concept of overscroll there.  I "hope" that enabling this wouldn't require anything from your site.  The goal would be that swipes from the left would open the drawer and if they did it again (and purposefully...might need to tweak the triggering from what Chrome OS has) then it would trigger this gesture.

If you have a ChromeOS device available, you might trying their existing behavior on your page (w/ devtools set to mobile viewport) which would be a good minimum bar for what we would expect.

But yes, we aim to make sure this doesn't prevent sites from building true app like experiences and this is targeting just the drive by web that would help people easily navigate.

Comment 16 by rbyers@chromium.org, Dec 5

Right, on ChromeOS today (which already has gesture navigation), sites with correctly implemented side-swipe gestures will not trigger the effect (i.e. either due to calling preventDefault on the touch events, use of CSS touch-action to disable horizontal panning, or use of CSS overscroll-behavior to disable horizontal overscroll effects).

The one remaining argument I've heard (eg. from the AMP team) against this is that it may still result in user confusion/frustration when a common gesture often has two very different semantics depending on the site you happen to be on (open drawer, or abandon all current state and go back).

I could imagine exploring some additional mitigations for this such as disabling the feature by default when running without browser chrome (i.e. as a PWA). Or maybe even gating horizontal overscroll on the presence of VERTICAL document viewport overflow - the idea being that "apps" tend to have content inside of a an app shell and so aren't scrollable vertically and users wouldn't expect swiping horizontally to go back/forward, while "documents" tend not to have app-like UI like drawers. But that would just be a heuristic.

Comment 17 by jinsuk...@chromium.org, Jan 4

New screen capture for the demo https://crrev.com/c/1249530
20190104_104302.mp4
10.5 MB View Download

Comment 18 by moh...@chromium.org, Jan 8

kOverscrollHistoryNavigation flag used to have 3 values, but is now a simple disabled/enabled feature (as of r602997). Does it make sense to unify it with the flag introduced here for Android?

Comment 19 by sunyunjia@chromium.org, Jan 14

Blockedon: 921718

Comment 20 by bkawaichi@chromium.org, Jan 15

Cc: bkawaichi@chromium.org

Comment 21 by jinsuk...@chromium.org, Jan 15

> kOverscrollHistoryNavigation flag used to have 3 values, but is now a simple disabled/enabled feature (as of r602997). Does it make sense to unify it with the flag introduced here for Android?

That sounds right. For now, Android-side gesture navigation needs to be behind a flag till the feature is completed and tested. I think they can be unified eventually.

Comment 22 by moh...@chromium.org, Jan 16

Re #21: Yes, the feature needs to be behind the flag. My suggestion was putting it behind the same flag on all platforms just to avoid confusion over multiple flags for the same feature. Each platform can have its own default value for the flag, though (e.g. disabled by default on Android).

Comment 23 by bugdroid1@chromium.org, Jan 18

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72

commit 1bf0f75c1a34121eeda65dd83e38357cb2dc7e72
Author: Jinsuk Kim <jinsukkim@chromium.org>
Date: Fri Jan 18 00:05:30 2019

Implement gesture navigation on Android

This CL enables side-wise overscroll gesture to trigger history
navigation.

Main UI implementation resides in chrome/browser/gesturenav/.
They are based on swiperefresh package (org.chromium.third_party
.android.swiperefresh), modified to support arrow widget for side
gesture, instead of pull-to-refresh with spinning ring.

Among the new classes, |SideSlideLayout| is the main FrameLayout
that hosts all the UI, and turns the gesture into triggering action.
This is used directly by SwipeRefreshHandler which now expands to
support side navigation as well as pull-to-refresh action for
WebContents.

SideSlideLayout is also used by HistoryNavigationLayout. It is
inherited by several layout classes for native pages like ntp to
support side-wise history navigation under chrome/browser/ntp.

chrome/browser/suggestions/SuggestionsRecyclerView was updated
for these native pages to support the gesture as intended. The
native pages based on HistoryNavigationLayout is supposed to
handle TouchEvents that are not processed by its children to do
its job, but it does not have chances to process them since the
RecyclerView always claims to have handled them. As a workaround,
RecyclerView provides an API indicating if it consumed the
horizontal gesture or not. This is utilized by
HistoryNavigationLayout to respond (or ignore) user gesture to
initiate its UI.

chrome/browser/feed/FeeNewTabPage also needs to know the similar
info from its view hierarchy. This requires a corresponding
change https://chromium-review.googlesource.com/c/feed/+/1395377
(WIP) from feed library.

Bug: 865567
Binary-Size: Increase needed to implement a feature.
Change-Id: Iad92a1105c9888f0d8937c7d45abfe0be542f504
Reviewed-on: https://chromium-review.googlesource.com/c/1249530
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#623921}
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedNewTabPage.java
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java/res/layout/recent_tabs_page.xml
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java
[add] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/ArrowDrawable.java
[add] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationLayout.java
[add] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/SideSlideLayout.java
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsRecyclerView.java
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/chrome/android/java_sources.gni
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/content/test/mock_overscroll_refresh_handler_android.cc
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/content/test/mock_overscroll_refresh_handler_android.h
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/third_party/android_swipe_refresh/README.chromium
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/third_party/android_swipe_refresh/java/src/org/chromium/third_party/android/swiperefresh/CircleImageView.java
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/ui/android/java/src/org/chromium/ui/OverscrollRefreshHandler.java
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/ui/android/overscroll_refresh.cc
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/ui/android/overscroll_refresh.h
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/ui/android/overscroll_refresh_handler.cc
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/ui/android/overscroll_refresh_handler.h
[modify] https://crrev.com/1bf0f75c1a34121eeda65dd83e38357cb2dc7e72/ui/android/overscroll_refresh_unittest.cc

Comment 24 by bugdroid, Feb 11 (6 days ago)

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999

commit 227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999
Author: Jinsuk Kim <jinsukkim@chromium.org>
Date: Mon Feb 11 01:04:35 2019

Android: Merge flags for overscroll history navigation

Extends the feature flag |kOverscrollHistoryNavigation| to be used for
Android platform as well, and remove the newly added one
|kGestureNavigation|.

Bug: 865567
Change-Id: I580120235825966b059190779e99e4957c436578
Reviewed-on: https://chromium-review.googlesource.com/c/1424628
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630674}
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationLayout.java
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/chrome/browser/about_flags.cc
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/chrome/browser/android/chrome_feature_list.cc
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/chrome/browser/android/chrome_feature_list.h
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/chrome/browser/flag_descriptions.cc
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/chrome/browser/flag_descriptions.h
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/content/public/common/content_features.cc
[modify] https://crrev.com/227f5c4e5c31f3e49bd9ee5d9e68b5a7f5852999/tools/metrics/histograms/enums.xml

Comment 25 by bugdroid, Feb 13 (4 days ago)

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88

commit 80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88
Author: Jinsuk Kim <jinsukkim@chromium.org>
Date: Wed Feb 13 03:08:11 2019

Android: More native pages become navigable

This CL enables history navigation on more native pages when they are
shown in a tab. Native pages shown as an activity (on mobile) are not
put in history stack like before.

Navigation gets canceled if these native pages consume user gesture
(mostly long clicks on bookmark/download/history items).

- Bookmark
- Download
- History

Bug: 865567
Change-Id: I6830a314e4b42c6515b3a47b0aa0de9e2b53fde9
Reviewed-on: https://chromium-review.googlesource.com/c/1423477
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631525}
[modify] https://crrev.com/80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88/chrome/android/java/res/layout/selectable_list_layout.xml
[modify] https://crrev.com/80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88/chrome/android/java/src/org/chromium/chrome/browser/download/home/DownloadManagerCoordinatorImpl.java
[modify] https://crrev.com/80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationLayout.java
[modify] https://crrev.com/80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemViewBase.java
[modify] https://crrev.com/80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java
[modify] https://crrev.com/80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java
[modify] https://crrev.com/80b0fbdbffd94ddb1cacd9b26ea45a292f9c7b88/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java

Sign in to add a comment