Skip to content
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

google chrome does not go back to previous position on the map #6712

Open
5 tasks done
francoisromain opened this issue Jul 1, 2019 · 1 comment
Open
5 tasks done

Comments

@francoisromain
Copy link

francoisromain commented Jul 1, 2019

  • I've looked at the documentation to make sure the behavior is documented and expected
  • I'm sure this is a Leaflet code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
  • I've searched through the issues to make sure it's not yet reported

Steps to reproduce
We use the leaflet moveend event to update the url with query parameters center and zoom. When the user navigates through the browser history with the back and and next buttons, the map goes back to the positions reflected by the url.

This works, except in one case:

  • in Google Chrome,
  • if the user interacts with the map only with the mousewheel or trackpad.

To reproduce the bug, open this page (bug repro) in Google Chrome: francoisromain.github.io/bug-leaflet-chrome.

  1. Reload the page.
  2. Interact with the map only with the mousewheel or trackpad (zoom-in or zoom-out). Don't click-and-drag, and don't use the zoom control-button. The url updates.
  3. Repeat the previous step a few times (Never click-and-drag, and never use the zoom control-button at all).
  4. Click the back button of the browser.

Expected behavior
Clicks on the back button, should bring back to the previous positions of the map.

Current behavior
The first click on the back button goes back to the previous webpage (or blank page).

Environment

  • Leaflet version: 1.5.1
  • Browser (with version): Google Chrome 75
  • OS/Platform (with version): Mac os and windows

Additional context
This works as expected in other browsers: firefox, safari, edge

Minimal example reproducing the issue
https://github.com/francoisromain/bug-leaflet-chrome

  • this example is as simple as possible
  • this example does not rely on any third party code
@Malvoz
Copy link
Member

Malvoz commented Jun 20, 2022

From https://francoisromain.github.io/bug-leaflet-chrome/:

How to reproduce the bug?

First, something that works

  1. Open this page in Chrome
  2. Interact with the map:
    • [...]

I noticed you don't necessarily have to interact with the map, if you first left-click any area outside the map for example. then use the mousewheel to zoom the map it works as expected too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants