Third party Image gallery: Back button unexpectedly navigates to previous page instead of closing the overlay

Steffen

Well-known member
Affected version
2.0.5
After an image gallery overlay has been opened, clicking/tapping the browser's back button unexpectedly navigates to the previously opened page instead of just closing the overlay. I know that there is a "close" button in the upper-right corner of the overlay and on desktop systems even the escape key works. But I think that especially on mobile the expected behaviour is that the back button closes an open gallery (which it doesn't in XenForo). Could you please fix this?

Big.Buck.Bunny.-.Frank.Rinky.Gimera.webp
 
Unfortunately, the behaviour of the library changed and it's no longer designed to work like that.

Perhaps we'd be able to extend that ourselves in the future, but that would need to be a suggestion.
 
Thanks Chris.

I cannot say that the developer's suggestion to use an older version of the library to fix such relatively basic functionality (IMHO) raises my confidence in the longer-term viability of lightGallery. :(

Have you evaluated PhotoSwipe? It implements correct history / back button behaviour out-of-the-box. It furthermore supports pinch-to-zoom. Maybe that could be an option for XenForo 2.1.

If not then I'd be glad if you could consider switching to lg-hash 1.0.1. The diff between version 1.0.1 and 1.0.4 (https://github.com/sachinchoolur/lg-hash/compare/1.0.1...1.0.4#diff-86f4b41fdda5a5e53dcd5e5e6441486f) seems to be relatively small.
 
I cannot say that the developer's suggestion to use an older version of the library to fix such relatively basic functionality (IMHO) raises my confidence in the longer-term viability of lightGallery. :(
The really frustrating thing is that when we chose it probably a year or two before we launched XF2, it was actually well maintained and we felt it worked really well.

It was some time before that which they moved to a different license which we were happy to purchase because the assumption, at the time, was that if anything it would improve faster and receive more updates. Unfortunately, the opposite was true. Only very small and occasional releases since then and certainly no significant further development.

My only reluctance with PhotoSwipe is, although it is very nice, that it too doesn't seem to be maintained and it has quite a huge list of outstanding issues and pull requests.

I've spent a whole lot of time over the past few years, going back to when I first developed the gallery in ~2013, evaluating various sliders and lightboxes. The perfect one doesn't exist. One day I'll write my own specifically for XF. Probably won't be prefect, but would be nice to be in total control of something to get it as close to perfect as possible. At one point we nearly ported over the XF1 lightbox which was generally fine, but it is of course lacking some fairly fundamental functionality that people expect from lightboxes these days - particularly touch and gesture support.
 
Top Bottom