I have some questions about Liveview and browser navigation. I’ll use the Elixirconf website https://2022.elixirconf.com/ as an example as it is probably the biggest publicly available Liveview site out there. (If you know more public facing websites using Liveview navigation let me know!)
If I press Refresh (ctrl+r) my scroll position is reset. Is this behavior innate to Liveview or is there a way to make browser refresh work normally?
Generally back/forward navigation appears to work great. But the anchor links on Schedule page only work when clicking. Navigating back/forward does nothing. Is this fixable?
Browser refresh scroll position reset does seem to be a current problem of Liveview as it happens on each of those sites. It is difficult to say why as the network tab appears to send all the contents of the page on first GET.
Elixirconf website’s anchor links apparently use live_patch for no reason and that probably messes up back/forward. Using regular anchor links should therefore solve the second problem.
Check out LiveBeats — meant to be THE instructional LiveView example site codebase; maybe it handles these things? It’s a much more sophisticated app than the ones mentioned here, to be sure.
Thank you, the link holds all the answers! And I didn’t even think of the other situations like disconnect/reconnect (very common on tabbed out websites on mobile) invoking the same behavior.