Bug 127771 - Layout recalculation makes viewport height equal to content height, impacting viewport-relative vh units.
Summary: Layout recalculation makes viewport height equal to content height, impacting...
Status: RESOLVED DUPLICATE of bug 131863
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad All
: P2 Major
Assignee: Nobody
URL: https://github.com/scottjehl/Device-B...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-28 03:37 PST by Paulo Pereira
Modified: 2014-06-11 15:14 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Pereira 2014-01-28 03:37:38 PST
This GitHub issue explains the issue in detail, with code examples and screenshots: https://github.com/scottjehl/Device-Bugs/issues/36#issuecomment-33470005

Short explanation:

Using vh units on Mobile Safari, such as on a 'max-height: 50vh' declaration, doesn't have the expected result. I’ve found the cause for this to be not the units themselves, but the viewport height that the units are relative too. This viewport height works as expected until any user or code-triggered event forces a layout recalculation — this can be a device orientation change or JS code such as Typekit.

When this happens, the viewport height appears to be set to the content height (I say appear because the visible area does not change). This causes viewport-relative units to have a value relative to the new viewport height, which is now the content-height, making them much much larger than intended, whereas these units are expected to work relative to the viewport height, usually the device height.

How to reproduce:

1. Use any viewport height relative value in an document element.
2. Trigger any layout-recalculating event, such as an orientation change, or some cases of JavaScript code.
3. Watch the height of said element change.
Comment 1 Benjamin Poulain 2014-06-11 15:14:51 PDT
Tim fixed this :)

*** This bug has been marked as a duplicate of bug 131863 ***