Page jumps after clicking N Likes


(Kane York) #1

Repro steps:

  1. Click here: Add new metrics in the administration interface
  2. Click on 3 Likes
  3. Press the back button
  4. Click the link again
  5. Click 3 Likes again
  6. Viewport should jump either up or down, causing more posts to load in and wrecking your read position

(Jeff Atwood) #2

Actually that does not repro for me, perhaps because I opened the link in a new window?

Nope, does not repro for me by clicking on the link here in this window either…


(Gerhard Schlager) #3

Yes, this only happens when the link is opened in the same tab (just tested on Chrome/Windows).
Weird, now it’s not happening anymore… :confused:


(Kane York) #4

If it doesn’t work, press back and try again.


(Jeff Atwood) #5

Aha so the proper repro is to do this twice:

  1. Click on the link
  2. Click to expand likes
  3. Click back
  4. Click on the link (again)
  5. Click to expand likes

Then I do indeed get the jumping behavior cc @eviltrout


(Robin Ward) #6

I just spent over an hour on this and I am still confused.

I am 99% sure at this point it’s a bug in Chrome, although I can’t find anyone else on the web reporting it. It seems that:

  • If you visit a topic page
  • Hit the back button
  • Go forward into a topic (needn’t be the same)
  • Adjust the innerHTML of any element on the page

Then the page will scroll randomly (usually upwards).

This only happens in Chrome for me, not Safari or Firefox. I used the Javascript debugger to isolate it down to a single innerHTML change, so it’s not jQuery. In fact, I can cause it outside of an event loop such as ember by just running a command like document.getElementById('post_25').innerHTML = 'hello'

I’m not sure how to proceed here – perhaps it will just be fixed shortly in Chrome? To make a bug report for them would involve tearing away many parts of Discourse until we could isolate it.


(Sam Saffron) #7

I worked around this issue, successfully with:

It’s not ideal but rerender is kind of rare and we may be amending this a bit with the DOM diffing.


(Sam Saffron) #8