Bug 127771

Summary: Layout recalculation makes viewport height equal to content height, impacting viewport-relative vh units.
Product: WebKit Reporter: Paulo Pereira <paulo>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Major CC: benjamin, robin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: All   
URL: https://github.com/scottjehl/Device-Bugs/issues/36#issuecomment-33470005

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 ***