Back button in Web APK doesn't navigate activities |
||||
Issue descriptionChrome Version: 61.0.3136.0 Canary (but it's been this way for ages) OS: Android What steps will reproduce the problem? (1) Install the twitter.com web apk. (2) Open twitter and sign in. (3) Tap a tweet, then a user, then another user. (4) Switch the native Google Search app. (5) Search for "twitter obama". (6) Tap the result for twitter. At this point your conceptual history stack looks like: 1. Login screen. (Twitter PWA) 2. Feed. (Twitter PWA) 3. Tweet. (Twitter PWA) 4. Profile. (Twitter PWA) 5. Another profile (Twitter PWA) 6. Google Search (GSA) 7. Obama twitter (Twitter PWA) <-- you're here. (7) Now hit the back button. What is the expected result? Hitting back should take me back to GSA (to history item 6). What happens instead? Hitting back starts navigating the web apk through the entire history stack, so we jump to history item 5, and then start going through every page I've ever been to in the web apk. So hitting back takes me to "Another profile", then to "Profile." then to "Tweet", etc. This means whenever you touch a link that takes you into a web apk you get trapped from an android history perspective which is frustrating as a user. It means you can't use web apks in the normal hub and spoke manner you could use native apps.
,
Jun 21 2017
I'm not sure. I *think* it's feasible but also tricky to get right. If we did it with android task management, we'd probably have to keep separate history stacks per instance of the activity. Alternatively, we need to track how many history events are created per instance and when that reaches 0, hit the android back instead of continuing to navigate the backstack. Note that many native apps also break this, sometimes intentionally sometimes not. For example, IIRC a deep link into a twitter post into the native app, then hitting back takes you to the feed (because Twitter wants to keep you engaged in their app).
,
Jun 21 2017
Ya, FullScreenActivity.handleBackPressed is pretty naive: if there's a history item, it goes back, regardless of what point in history brought the activity forward. That said, the flow mentioned in OP doesn't seem right either (or at least after another back). If you're switching to "GSA" that's switching tab stack. So I think you actually have: Task A ----- 1. Login screen. (Twitter PWA) 2. Feed. (Twitter PWA) 3. Tweet. (Twitter PWA) 4. Profile. (Twitter PWA) 5. Another profile (Twitter PWA) Task B ------ 1. Google Search (GSA) 2. Obama twitter (Twitter PWA) <-- you're here. (7) Now hit the back button. I agree that you should get to GSA. But hitting back again, should take you to the homescreen and not back to the PWA (at least I think that's how Android works :) The one tricky bit for us, is that we'd want to navigate the history state back but not actually reload the page until the user comes back to the page. Anyway, we can put this on the polish and parity list. Thanks for raising it.
,
Jul 11 2017
Peter is interested in this
,
Jul 22 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5f8fd9e4d2185d6c48f592f4b9f05de1ca04ac17 commit 5f8fd9e4d2185d6c48f592f4b9f05de1ca04ac17 Author: Peter Kotwicz <pkotwicz@chromium.org> Date: Sat Jul 22 04:27:44 2017 [Android WebAPK] Clear back history when navigating WebAPK from deep link The CL does this by plumbing LoadUrlParams::should_clear_history_list to Java BUG= 735074 Change-Id: I5a7c42abc70b7a6f6175c53156faae9a988faee0 Reviewed-on: https://chromium-review.googlesource.com/573115 Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org> Reviewed-by: Xi Han <hanxi@chromium.org> Reviewed-by: Dominick Ng <dominickn@chromium.org> Reviewed-by: Ted Choc <tedchoc@chromium.org> Cr-Commit-Position: refs/heads/master@{#488853} [modify] https://crrev.com/5f8fd9e4d2185d6c48f592f4b9f05de1ca04ac17/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java [modify] https://crrev.com/5f8fd9e4d2185d6c48f592f4b9f05de1ca04ac17/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java [modify] https://crrev.com/5f8fd9e4d2185d6c48f592f4b9f05de1ca04ac17/chrome/browser/android/tab_android.cc [modify] https://crrev.com/5f8fd9e4d2185d6c48f592f4b9f05de1ca04ac17/chrome/browser/android/tab_android.h [modify] https://crrev.com/5f8fd9e4d2185d6c48f592f4b9f05de1ca04ac17/content/public/android/java/src/org/chromium/content_public/browser/LoadUrlParams.java
,
Jul 28 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by owe...@chromium.org
, Jun 20 2017