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 Bugs | Assignee: | 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 |
Paulo Pereira
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.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Benjamin Poulain
Tim fixed this :)
*** This bug has been marked as a duplicate of bug 131863 ***