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

Trying to view a report on mobile has an intermittent flickering bug #2130

Closed
wrightmartin opened this issue May 17, 2018 · 7 comments · Fixed by #2150
Closed

Trying to view a report on mobile has an intermittent flickering bug #2130

wrightmartin opened this issue May 17, 2018 · 7 comments · Fixed by #2150

Comments

@wrightmartin
Copy link
Contributor

wrightmartin commented May 17, 2018

  • Open FixMyStreet.com on mobile
  • Start a new report
  • Click an existing report on the map
  • It appears, then closes immediately and the map recenters

Appears to be intermittent, and more likely to happen on the first attempt.

Tested on a Pixel 2, running Android 8.1.0, Chrome browser

@dracos
Copy link
Member

dracos commented May 17, 2018

Yep same here, Chrome 66, Android 6. Think this must be relatively new!

@zarino
Copy link
Member

zarino commented May 17, 2018

Can’t replicate it in Safari or Firefox on iOS (both using the iOS webkit renderer), or Safari 11 or Firefox 60 on macOS.

But it does also happen in Chrome 66 on macOS, when the window is narrow enough to trigger mobile mode.

So looks likely to be a Chrome thing! Will see whether I can work out what’s happening.

@zarino
Copy link
Member

zarino commented May 18, 2018

Causes the flicker:

  1. Go to fixmystreet.com at a mobile width, in Chrome
  2. Enter location, click "GO"
  3. Click a marker
  4. Notice how the screen momentarily transforms into the report detail screen, and then switches back to the /around screen

Does not cause the flicker:

  1. Go to fixmystreet.com at a mobile width, in Chrome
  2. Enter location, click "GO"
  3. Drag the map, so that an ajax request to /around?ajax=1 is sent
  4. Click a marker (original, or newly loaded, it doesn’t matter)
  5. Notice the flicker doesn’t happen, and you’re taken to the report details page as expected

@zarino
Copy link
Member

zarino commented May 18, 2018

More detail…

It looks like the $('#map_sidebar').on('click', '.js-back-to-report-list', function(e) { handler on line 867 of fixmystreet.js is getting called erroneously, and that is what causes the screen to transform back into the /around view (fixmystreet.display.reports_list).

@zarino
Copy link
Member

zarino commented May 18, 2018

Aha! This is the line that’s causing it: https://github.com/mysociety/fixmystreet/blob/master/web/js/map-OpenLayers.js#L952

@zarino
Copy link
Member

zarino commented May 18, 2018

Infuriatingly, I can’t reproduce this in Chrome on browserstack, so I can’t work out which version introduced the bug, if indeed it is a bug in Chrome.

It looks like, in Chrome only, OpenLayers.Control.Click is getting triggered after the /report page has been ajaxed in, and therefore $('.js-back-to-report-list').length returns true (as far as the code can tell, we’re on the /report page at this point, and we’ve just clicked the map, which means we need to go back to the /around map view) which kicks us back to the /around view.

I don’t know why OpenLayers.Control.Click is getting triggered after the ajax request. Is it the same click that triggered the ajax request in the first place? Or is it a new click event?

@dracos dracos added the Options label May 21, 2018
@zarino
Copy link
Member

zarino commented Jun 4, 2018

Firefox (top) vs Chrome (bottom):

screen shot 2018-06-04 at 14 42 15

Note the extra OpenLayers.Control.Click call at the end of the Chrome console log. That’s what causes the report to hide.

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

Successfully merging a pull request may close this issue.

3 participants