enhancement: back navigation to take back to the previous page#19381
enhancement: back navigation to take back to the previous page#19381criticalAY wants to merge 1 commit intoankidroid:mainfrom
Conversation
|
Important Maintainers: This PR contains Strings changes
|
cd916bc to
7b4df44
Compare
ff29589 to
dc36a07
Compare
lukstbit
left a comment
There was a problem hiding this comment.
No, I don't think this is ok.
We always have two options to "exit" a screen, BACK and toolbar Up button which are established patterns. Adding an "X" just clutters the UI.
|
It is cluttered right now but after the search button is removed it will be fine IMO, I am ok fixing the bug but the problem with that case would be that if user navigates too much in the webview i.e. clicking multiple urls then they would have to press back button a lot of times to go to deck selection screen itself hence I think having a close button is better just in case so that we cover worst case but if others are not happy then I would remove it and simply fix the nav bug |
They have the navigation UP button for that, which is specifically for this case(always go back to the previous screen). By cluttering the screen I mean we would be adding a button in the toolbar to go to the previous screen when we already have a button in the toolbar to go to the previous screen.
This is not normal behavior for apps that implement the normal toolbar. |
|
I can go with the navigation issue fix which the original issue states I am totally fine with that, waiting for others to respond |
|
Agreed with lukstbit. Back button goes back, toolbar button closes the screen. No new buttons. |
dc36a07 to
0acb2f5
Compare
0acb2f5 to
07cd4a9
Compare
| if (item.itemId == R.id.home) { | ||
| // R.id.home refers to a custom 'home' menu item defined in your app resources (res/menu/...). | ||
| shouldHistoryBeCleared = true | ||
| webView.loadUrl(resources.getString(R.string.shared_decks_url)) | ||
| } else if (item.itemId == android.R.id.home) { | ||
| // android.R.id.home refers to the system-provided "up" button in the app toolbar | ||
| onBackPressedCallback.isEnabled = false | ||
| when (item.itemId) { | ||
| R.id.home -> { | ||
| shouldHistoryBeCleared = true | ||
| webView.loadUrl(resources.getString(R.string.shared_decks_url)) | ||
| } |
There was a problem hiding this comment.
If we want to fix the issue OP raise then this would make the behaviour of back button and the navigation button in toolbar same but if we want them to act differenly then I think this PR and the issue can be closed, but its gonna be confusing and I think thats why @Arthur-Milchior raised that issue, leaving to reviewers
mikehardy
left a comment
There was a problem hiding this comment.
I dunno. I loaded this up on an emulator as is right now and I think it behaves the way I'd expect, without thinking too deeply on the original issue (as in, I read the issue, I read all the comments here, but then I cleared my mind and just used the app). It works the way I expect an app to work
inside the webview:
- the back arrow goes back into preview webview state unless I'm out of webview state then pops me back on app back stack
- the system back does...the exact same (which I expect)
- the webview home icon takes me to the root of the webview which...makes sense, I'm not bothered or surprised really - it didn't go too far back, which is the only possible surprise for an icon that has an action you're not sure about as a user, so this passes for me
UI is uncluttered. I think it does solve the OP issue. I like it as is right now.
|
I strongly believe that both this PR and the original issue should be closed. The Changing it breaks both internal consistency among the app and the external consistency with the whole Android ecosystem. |
lukstbit
left a comment
There was a problem hiding this comment.
App bar UP button is always expected to go the previous screen. Changing it to make it navigate through the WebView's history is a clear no from me.
|
Interesting, to me, since the integration of the web screens are made to be as seamless as they are, they feel as a user like regular screens. I'm not mentally differentiating "this is a web page" from "this is an app screen". Thus my take that it "felt" right with this PR as is. Maybe my perspective is off or my understanding is off though. @BrayanDSO and @lukstbit - is your mental model of the app strictly differentiating between "native android screen" and "pages within some webview" such that screens and pages are different and unequal ? And your dislike for this is based on that? |
|
Right - so, if I've clicked into "download shared decks" (a page?), and then tapped "Japanese" (for language decks) I am now on a new webview page, but it feels like a "page", and then if I tap a specific deck I'm on that deck page. If I tap that arrow, in this PR when I built it and looked, I go from the specific deck back to the list of Japanese decks, then to the main shared decks page, and then back out to the deck list (where I was when I tapped the FAB for shared decks) So, it felt to me like it was backing out in a sane way? But hey, I could be wrong 🤷 (like maybe I'm too "web"y of a mental model and the android toolbar emphasis you made is the differentiator, and I just don't think that way |
|
I don't think the discussion is about what a screen is it's more about what we expect to happen when using either of the buttons:
In a web browser the analogy would be UP being the close tab button(not matter how much history I have in this tab I'm done with it and I want to go to tab next to it) and BACK being the browser's go back a page(most browser don't close the tab when you get to the first page, in android BACK does this). |
|
I am ok with anything it being closed or merged, and since most of you are in favour of closing it so lets do it |
Okay, but the app without this PR, if you choose the back icon while deep in a web stack, closes the whole web stack and punts you out of the webview. I just tested it. This is unexpected for me. So, I prefer the behavior of this PR. |
Purpose / Description
Fixes
Approach
Remove search option as it is redundant and introduces a close icon instead
How Has This Been Tested?
Google Pixel API 35 Emulator
Screen_recording_20251029_144107.webm
Learning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.