browser history forward does not open the lightbox
Tested with the lightbox on /examples/everything.amp.html
Steps: Click on the "Responsive (w/srcset, w/lightbox)" image Close the lightbox by either clicking using the browser back button Note that there is now a forward history entry Navigating forward does nothing
It shouldn't. At least it's not clear that it should. In case of the viewer and switching between articles - we are best not closing the lightbox at all. But that's also arguable.
Do you think it should open it again?
I'm not sure if there is a normal behavior for modal lightboxes like this, but it leaves an entry in the forward history stack so feels a little confusing that you can navigate forwards but nothing changes.
Ok. I think it means we also may need to add "historyPushed" state? I initially envisioned "historyPopped" only for popping. I know in History API it's the same event for both, so we can explore doing the same - but it's definitely counterintuitive and hard to support. I.e. one always knows how to go back, but not always how to go forward.
With my current implementation the viewer is listening for all popstate events from the browser and sending them on to the AMP doc via "historyPopped" whenever this changes the stack value. So this could be from a forward or backward navigation. From the viewer side, this is simpler than trying to figure out if it is forward or backward.
Also, thinking about it more, I don't think that navigating forward probably doesn't happen very often compared to navigating back so this probably isn't a big deal. This behavior was surprising to me when I noticed it, but from the perspective of the Viewer, I don't know that it matters.
It's definitely rare. Especially on the mobile where "forward" button is typically buried somewhere. I guess, yes, let's assume that historyPopped will be sent for all types of popstate events. I somewhat dislike that name, but it's better to be consistent with the existing API.
I will close this issue for now then.