nprapps / papertrail

Rig for deploying DocumentCloud viewers to S3.
Other
13 stars 4 forks source link

Mystery extra padding appears above document in embed view #45

Closed alykat closed 9 years ago

alykat commented 9 years ago

In the embedded version, the document inserts an extra 60px of space between itself and the header. (Not sure if this is coincidental, but the header is also 60px tall.)

http://www.npr.org/blogs/itsallpolitics/2015/04/03/397110609/this-guy-is-running-for-president-and-so-are-more-than-200-others

Extra-weirdly, it's only happening in production — I don't see it on localhost. Also, when the standard DocCloud embed is used (rather than the Paper Trail version), everything is fine:

https://twitter.com/documentcloud/status/584108192008908800

So I wonder if there's something weird on our end? Here's how it looks on production: http://apps.npr.org/documents/document.html?embed=true&id=1701420-form-2-fec

image

And on localhost: http://127.0.0.1:8000/document.html?embed=true&id=1701420-form-2-fec

image

alykat commented 9 years ago

From Ted Han: https://twitter.com/knowtheory/status/584121896649658368

In your onDocumentLoad func: viewer's offset top is set a 2nd time after viewer is positioned

onyxfish commented 9 years ago

I've replicated this bug locally, so... something must have changed with DC. It def hasn't always done this and there hasn't been a commit on papertrail in 9 months.

onyxfish commented 9 years ago

Fixed. Not sure what changed, but the simplest fix was to not modify the iframe offset after it's loaded.