-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slideshow: should the browser back button behave the same as the X icon? [$5] #160
Comments
I did a few more tests. It looks like the browser history is handled differently depending on if we start in the files view or the gallery view. If I...
...I am taken back to the gallery thumbnail view. It's not the files view, but at least the back button takes me out of the slideshow. If I...
...the URL changes to end with !. Another back button click changes to the URL to the previous photo, but nothing changes on the screen. If I keep clicking the back button, I can watch the URL change through photos (without loading them) until eventually I back out to the gallery thumbnail view. |
I see galleryfileaction.js has a reference to history.replaceState inside a slideShow.onStop function. Perhaps we just need something similar in gallery.js. I might experiment with this to see if I can make it more consistent. EDIT: Nope... bad idea. :) |
Hehe, interesting findings! Thanks for documenting that. I didn't look at this side of things at all. I only focused on fixing the URLs so that the Files or thumbnail views were not reloaded and losing their current position. I'm guessing that since the URL changes, we could make sure it updates the slideshow and when we reach the beginning we would quit and go back to the original view The gallery side has the same fix as the Files side for going back to where we were when the back button is closes. On the whole, I don't feel this is a priority since the X button is always present and we can navigate by either clicking on the buttons, using shortcuts or hopefully in the near future using swiping movements. |
I also want to add that every time you quit the slideshow, the history will have a hole in it. Nothing should happen when you have reach !, so in terms of usability, I don't think encouraging users to use the back button is the best thing, but if you have ideas on how to fix it, I'll listen :) |
I want to add something else I've noticed to this issue thread. If you use the "f" key to get into fullscreen mode, you have to click the "X" icon twice to exit the slideshow. It's not entirely the same issue, but it's all related to exiting cleanly from the slideshow. |
OK. Will try to take that into consideration when trying to implement a fix |
The following isn't a good fix for this because it causes a page reload whenever the browser back button is used or the X icon is clicked. It does demonstrate better back button behavior though. It also gets us out of fullscreen mode without a second click. What is the best way to force the slideshow to close? I put this in slideshowzoomablepreview.js right after the new "orientationchange resize" bind logic.
|
This issue was still bothering me, so I worked on it more. :) I have it so it no longer needs a page reload, and it still saves the position in the gallery. I moved the popstate bind into gallery.js. It is at the end of Gallery.slideShow. The existing slideshow logic never pushes a new address into the history. It only ever replaces the address that is currently shown. This is what allowed my original reload hack to work. The URL after a browser back action was valid for a reload. Now, instead of a reload, I am stopping and hiding the slideshow only if zoomable is not null. I wanted to be sure that the gallery's onStop function got called. I was having problems getting that to work without this logic in the same scope as the onStop function (slideShow.stop calls this.onStop).
I feel strongly about the back button needing to exit the slideshow based on my experience on mobile android devices. If you think this logic is decent I can create a pull request at some point (busy for the rest of the day). It is working good for me. |
Thanks for looking into this :) It seems popstate is the way to go when dealing with the back button. I think a PR is the best way to work on changes like this because it's easier to quickly test various scenarios using the exact same version of files. On the top of my head, here is what needs to work Files
Photowall
General
|
I agree with most of that, but I think we should discuss one of those items.
I feel that pressing back while you are in the slideshow (no matter which image you are on) should take you back to the point where you entered the slideshow. Pressing forward from there should take you to the image you were last on in the slideshow. Once out of the slideshow, the back button should not be impacted at all by this change. You should still be able to back through gallery folders, etc, as you would normally expect without any funny business. What I see in the code suggests that this was the original intent. The slideshow calls history.replaceState (NOT pushState) to change the URL displayed for each photo as we navigate through the photos. This does not actually change ANY history, it simply changes the current URL displayed as you flip through photos. If you click the back button from anywhere, the URL is correctly taking you back to where you entered the gallery. The only thing missing that we need to add is the part that actually stops and hides the slideshow and therefore displays the correct content for the URL in the address bar. This is all that I really thing needs to be added... everything else is already there and working. Also, if you reload the page while watching the slideshow, everything works great because the URL displayed is the correct URL to reload the page with. I originally thought the history was getting mangled, but I was actually just backing through multiple in-and-out-of-slideshow navigations contained in my history without actually seeing the running slideshow close. This is why my second comment on this issue is painting a confusing picture. I really hope I'm making sense. :) To simplify this, the back button should really just call slideShow.controls._stop(). This works great for me, but it is currently marked as a private function. Can we make that public, or make a public function that calls _stop? I encountered another issue where calling slideShow.controls._stop() fixes everything. If the user clicks play instead of clicking through the slideshow manually, I was not resetting the slideshow timer and would be taken back into the slideshow. |
I'm all OK with this. That's what I meant by it. An example navigation Using the back button from the end F=Files |
Ah... after I cracked your cryptic code, yes. I think we're on the same page. :) You don't want any holes shot in the history. The slideshow itself should leave a history entry based on the last image that was viewed, not ALL images that were viewed. I think that all sorta works today. My tweak will only fix the exit situation so the slideshow actually stops and hides when navigating back through the history. I have this working for gallery, but nothing has changed for files yet (haven't looked). Right now, a slideshow from files will exit the slideshow with the back button, but goes to a gallery view instead of files. That was a lower priority for me since the back button is sorta working. I need to jump through some github hoops here to make my first change visible in a pull request. I think we'll need to refactor it though because of the call to a function labeled private. |
:) Ah, yes, I forgot to reply regarding the method's visibility. It's fine to change it. The only reason I even want to load the slideshow during history navigation is just to keep the code simple and the user experience consistent. I don't think it adds great value to load the slideshow you opened 30 minutes earlier. |
Current situationFilesHow it works
Pressing on "close":
That's ideal as I've reconsidered keeping the slideshow in the history as I don't see the value in loading the last slide, especially when navigating through albums or folders. Pressing on "back":
In order to support the back button we can try the following:
So, it seems we'll have to choose between:
Not once have I thought about using the back button when using ownCloud, but that's because I'm always using it on a desktop. |
My current pull request didn't address anything with the files interface. That is currently left as it always has been. It only changed the back button behavior from the gallery view. It also hasn't been refactored. It is simply calling a privately named slideShow.controls._stop(). What do you think of how it works from gallery view, not files view? If it works well, I can refactor by creating a slideShow.controls.back() or something similar that then calls _stop(). The behavior of things from the files view needs work, yes, but one thing at a time. :) |
Yes, I was too tired to make the same assessment on the Gallery side :D. So we could have a working Gallery, with position memory and if Files gets fixed in 8.2, we might be able to have a coherent behaviour on both sides. If I can keep the position in Files by using pushState, then we might have a working solution before that... |
One thing to note is that _stop() was being executed twice in my fix if the close button was pressed. I left it that way because it was actually fixing the other problem related to needing to press the button twice to close a slideshow in fullscreen mode. It wasn't causing any other issues to call it twice that I could see. A better fix would be to somehow see if we were already inside a call to _stop() before calling it again. That would also require fixing the double button press to exit fullscreen. |
Ah, thanks for the reminder. I've worked to eliminate lots of unnecessary events and divs and will try to find a solution to exit the slideshow with one click when in fullscreen mode... |
Good news, I'll be able to restore the position in the Files app :). The list still gets refreshed, but there is nothing we can do on 8.0 and 8.1. |
Can be tested by using @libasys you may be interested in the fix for GaDe |
Is this also on ultimatedev? If so, I see a difference between using the browser back and the X. The thumbnail for the current position is grayed out when returning using the browser back and it is not grayed out when returning using the X. This is the same grayed out look the thumbnail has when you are clicking on it with a mouse. I'm not sure if the desired behavior is to show the position with the grayed out thumbnail or not. It is still very much usable either way. |
Good eye. It's always been there on Firefox and I didn't care much for it, but now that I'm trying to harmonize the apps' behaviour, I should take care of this. We will need a new ticket so that designers can help me decide which option is best. |
@setnes Don't forget to collect your bounty ;) |
Public sharing was broken because the legacy router passes those values as `$_GET` which has to be accessed this way in this situation. Furthermore this makes legacy links work again as they used `t` instead of `token` Needs a backport to stable8. Fixes owncloud/gallery#162 and owncloud/gallery#160
The browser's back button doesn't behave as expected. If clicking the big X in the upper right side of the screen exits the slide show, perhaps the back button should do the same thing. I feel a bit trapped in the slide show on a mobile device if the back button doesn't actually exit. I'm not sure what is correct here from a UI standpoint though. One could also make a case that back should just go to the previous image.
@oparoz's assessment of the situation
Files
How it works
Pressing on "close":
Pressing on "back":
@oparoz's acceptance criteria
Files
Photowall
General
Did you help close this issue? Go claim the $5 bounty on Bountysource.
The text was updated successfully, but these errors were encountered: