-
Notifications
You must be signed in to change notification settings - Fork 1.3k
For #13336: Open bookmarks in current tab #23169
Conversation
No Taskcluster jobs started for this pull requestThe `allowPullRequests` configuration for this repository (in `.taskcluster.yml` on the
default branch) does not allow starting tasks for this pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good. You need to fix the tests (see the run-testDebugUnitTest
task) and comment below. 🙂
@@ -77,7 +77,7 @@ class DefaultBookmarkController( | |||
val flags = EngineSession.LoadUrlFlags.select(EngineSession.LoadUrlFlags.ALLOW_JAVASCRIPT_URL) | |||
openInNewTabAndShow( | |||
item.url!!, | |||
true, | |||
false, // See https://github.com/mozilla-mobile/fenix/issues/13336 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add a reference to the issue here. The commit message contains a reference to it already.
false, // See https://github.com/mozilla-mobile/fenix/issues/13336 | |
false, |
363184a
to
1ddef7e
Compare
@jonalmeida
According to the test at fenix/app/src/test/java/org/mozilla/fenix/library/bookmarks/BookmarkControllerTest.kt Lines 112 to 132 in a49f80d
However, this issue is for the bookmark to open in the current tab, so the test is failing |
That's correct! The verify was asserting that we always opened in a new tab, and this the behaviour you've changed, so we just need to fix the test to verify the new behaviour. 🙂 |
Ok, I've corrected the test. |
About the new behaviour of opening in the current tab, since Fenix doesn't associate the home screen with a physical tab, I found out that this will cause a problem: If the user opens a new tab(clicks New Tab), then subsequently opens the bookmark, the bookmark would open in the previous tab, which may not be the intended action the user wanted to take. How should we fix this side effect? (is there a method to find out whether the user is on the home screen page of a new tab? - there could be other instances where the home screen is launched without the intention to open a new tab, e.g. the home button) |
I've modified the test, but it's still failing |
@jonalmeida |
@czlucius there were two tests that were failing:
You fixed one correctly, you just need to fix the other. 🙂 |
bde067b
to
222cf09
Compare
I've fixed the tests already.
What do we do about this?
Should I also change the test name to reflect the new behavior? Thank you. |
@jonalmeida @czlucius isn't there a way to, for example, know if the home button is visible? |
@jonalmeida what do I do to continue from here? |
Sorry, I lost track of the message thread!
🎉
Interesting. There is no concept of a "new tab" in Fenix, it's just the home screen. When the bookmark is opened, does it switch to that tab that it loads in? If so, I think that would be acceptable behaviour for now given how Fenix currently works. We can also discuss this further with UX in a separate issue as well.
Yes please! The name of the test should reflect the behaviour of it. If we're changing the behaviour, someone else coming back to this code in the future will be very confused why it says something and does something else. 🙂 |
Ok 👍 |
Your comment got me to think about if the user has 0 tabs(starting from a clean state), then this behaviour will attempt to open the bookmark in a nonexistent current tab, which may result in a crash or no-op. I shall go test this behaviour later. |
Quite interestingly, the code still works well when I open a bookmark when number of tabs is 0. I guess |
This is good train of thought to consider and even better that it is already handled by the |
@czlucius I tried out the patch and it looks good! However there is one more entry point into bookmarks from the home screen's "Recent bookmarks". I wonder if you're interested in also fixing that too? Otherwise, we can file a separate bug for it. I'm also happy to land this as is, and if you're still interested in picking up the other issue as a follow-up. 🙂 |
I think the recent bookmarks from the home screen is somewhat related to this issue: #20012 If bookmarks were to open in the current tab, but top sites still open in a new tab, the behaviour will be quite confusing. Furthermore, the home screen is also shown when the user explicitly clicks "New tab", and opening the recent bookmark in the current tab would not be the intended behaviour in this case. Thanks. |
@jonalmeida The minor flaw that I described earlier is illustrated in this recording: Screen_Recording_20220130-225842_Firefox.Preview.mp4Thanks. |
Please open this issue & Thanks for your efforts so far 👍!! |
2659d52
to
e9b4089
Compare
#2871 is related as well, and since this is fixed, that issue may be fixed too |
@jonalmeida Is there a method that returns whether the home screen is opened? We could open in new or current tab based on this value. Thanks! |
Created bug #23609 to address top sites behavior |
#23659 another one reporting the new behavior as a bug |
@jonalmeida this seems to be causing problems, as seen in #23595, #23659, and #23746. I think this should be looked into(before this gets into release). |
No, I was talking about the problems caused by changing the behavior to open bookmarks in the current tab. |
Oh! My mistake then! Sorry. |
This reverts commit e73deb2.
This reverts commit e73deb2.
This reverts commit e73deb2. (cherry picked from commit d1c0e9b) Co-authored-by: Roger Yang <[email protected]>
…le#23169) * For mozilla-mobile#13336: Open bookmarks in current tab * For mozilla-mobile#13336: Fix tests to verify bookmark opening in current tab * Change test name for handleBookmarkTapped
…lla-mobile#23169)" This reverts commit e73deb2.
Pull Request checklist
To download an APK when reviewing a PR:
Hi there
These are my fixes to #13336, to open bookmarks in the current tab. I am not sure whether this change is approved, but as the issue is still open, I am submitting a draft PR.
May I ask the Fenix UX team for their approval on this change, or is the bookmarks opening in a new tab as intended? I can work on it to add other things if needed.
Thank you!
Here are the videos of the proposed change:
1.Screen_Recording_20220112-231257_Firefox.Preview.mp4
Bookmarklets also work:
Screen_Recording_20220112-231756_Firefox.Preview.mp4