masakudamatsu / line-height-picker

A front-end web app that helps web designers/developers pick the best line-height value for their websites
https://line-height-picker.vercel.app
MIT License
2 stars 1 forks source link

Browser's back button makes the page move in the opposite direction #210

Open masakudamatsu opened 4 years ago

masakudamatsu commented 4 years ago

Problem

Ideal solution

masakudamatsu commented 4 years ago

How to detect the back button click and the forward button click: https://stackoverflow.com/a/60125216/11847654

masakudamatsu commented 4 years ago

A possible solution

  1. Use document.onreadystatechange = () => {} to detect the loading of a page

  2. Detect whether page is loading after the browser's back/forward button click

  3. Use the array of history to check whether the previous page is to the left or to the right

  4. Overwrite the page transition animation class name on TransitionGroup component

masakudamatsu commented 4 years ago

A day of investigation reveals: