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

Absolutely positioned elements are misplaced #423

Open
rkwright opened this issue Nov 16, 2017 · 5 comments
Open

Absolutely positioned elements are misplaced #423

rkwright opened this issue Nov 16, 2017 · 5 comments

Comments

@rkwright
Copy link
Contributor

rkwright commented Nov 16, 2017

This issue is a Bug

Related issue(s) and/or pull request(s)

None known

Expected Behaviour

Red rectangle should be in the lower left corner of visible window

Observed behaviour

Instead, the rectangle is located off the page. See screenshot

bad_loc

Steps to reproduce

  1. Open test file in Chrome app (or OSX Loader)
  2. Go to page 4
  3. Observe that rectangle is in wrong place

Test file(s)

https://drive.google.com/open?id=10y7ZJKdoG2yDVfqXLRkCWrDcbRDhW_eq

Product

Readium Chrome extension 0.29.alpha
Cloud Reader 0.29-alpha
OSX Launcher 0.29
others not yet tested

Works correctly in iBooks on OSX 10.11

Additional information

Please list any additional information that might help us

@rkwright
Copy link
Contributor Author

Additional data-point: In reflowable document, the same construct i.e.

<div id="dat.gui" style ="border-style:solid;border-color:red;position: absolute;bottom:0;left:0;height:50px;width:100px;z-index: 10;">Wowser</div>

Is placed at the bottom of the reflowable-content box.

@danielweck
Copy link
Member

danielweck commented Nov 16, 2017

position: absolute relative to which DOM ancestor?
When I load xhtml/chapter04.xhtml in a vanilla web browser, the red box appears in the lower-left corner, as low as possible within the visible viewport (overlaid on top of the main document's text). When I resize the window, the red box "sticks" to this corner. PS: if I scroll the window contents, then the red box disappears out of view, which means that the absolute positioning is not relative to what you want, I think.

@danielweck
Copy link
Member

I've just tested in iBooks and the HTML renders in the same way as the Chrome app.

@rkwright
Copy link
Contributor Author

rkwright commented Nov 16, 2017

Hm. This is what I see in iBooks (v. 1.10 (1289)) on OSX:

ibooks_abs
Are you seeing something different?

@danielweck
Copy link
Member

Okay, once I set body@style="margin:0" in chapter4.xhtml, I get a pixel-perfect rendition in iBooks (webkit), Readium Chrome app (Chromium) and Readium web / cloud reader in Safari (webkit) and Chrome (Chromium).
Without the margin reset on the body element, browsers automatically apply an 8px margin around the body, which screws-up aspect ratio calculations for scaling the iframe (using CSS transforms) to the dimensions of the visible viewport (in other words, the body has a smaller size than the html document itself, and as a result some content gets clipped at the bottom of the page).

So, I believe Readium's fixed-layout code should be fixed by forcing the body margin to zero. This will match iBooks behaviour.

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