Oneboxed Google Docs break scroll position

It seems that embedding Google docs results in a page scrolling automatically to top.

I was only able to reproduce this on all latest browsers on Yosemite. It does not happen always (but still in a majority of tries) and seems to be based on how quickly the embedded content loads.

Steps to repro:

  1. create a post below the page fold with a link to Google spreadsheet
  2. get the persistent link to the post and open the page
  3. the page should load and be correctly scrolled (embedded content not loaded yet)
  4. embedded content loads and another scroll is triggered

What should happen is the page should be scrolled to correct position.
Instead the page is scrolled to the top of the page currently loaded (not the first post if the thread is long).

Demo: open in new tab, clicking it would not result in reload and the bug would not trigger

https://meta.discourse.org/t/oneboxed-google-docs-break-scroll-position/28919/2
3 Likes

Test case:

– making sure this thread is tall enough



















Yes, any embed that has variable height will completely screw up positioning in the stream. There is no way around this unless the embed has a guaranteed height.

2 Likes

Fair enough, but I’d say the original scroll position is correct; why is a second scroll called when onebox loads? Omitting the second scroll would solve this particular issue of random scroll to the top of the page, wouldn’t it?

Because we are at war with the web browser especially when you hit the back button

2 Likes

This bug is pretty annoying. I’m somewhat motivated to help fix it. Is there any reason for the Google Docs onebox not to have a fixed height?

1 Like

No idea, depends on the embed api. We found that Twitter did return the size of images in tweets so that became possible. Size of embed is critical to us. Variable height embeds are a total no-go in the post stream; they have catastrophic, and cascading effects.

3 Likes

We need to remove this embedding in favor of a simple link to the document as previously discussed @techapj. Can you try to get to that, this week?

4 Likes

Done via:

and

Demo oneboxes here:

3 Likes