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

fix: set viewport-fit=cover to enable CSS env() variables in PWAs #20836

Merged
merged 5 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
/**
* Defines a viewport tag that will be added to the HTML of the host page of a
* UI class. If no viewport tag has been defined, a default of
* <code>width=device-width, initial-scale=1.0</code> is used.
* <code>width=device-width, initial-scale=1.0, viewport-fit=cover</code> is
* used.
*
* @author Vaadin Ltd
* @since 1.0
Expand All @@ -42,20 +43,20 @@
* <p>
* Recommended for a Responsive Web Design.
*/
String DEFAULT = "width=device-width, initial-scale=1.0";
String DEFAULT = "width=device-width, initial-scale=1.0, viewport-fit=cover";

/**
* Sets the viewport to the height of the device rather than the rendered
* space.
*/
String DEVICE_HEIGHT = "height=device-height, initial-scale=1.0";
String DEVICE_HEIGHT = "height=device-height, initial-scale=1.0, viewport-fit=cover";

/**
* Sets the viewport at the width and height of the device. The device-width
* and device-height properties are translated to 100vw and 100vh
* respectively.
*/
String DEVICE_DIMENSIONS = "width=device-width, height=device-height, initial-scale=1.0";
String DEVICE_DIMENSIONS = "width=device-width, height=device-height, initial-scale=1.0, viewport-fit=cover";

/**
* Gets the viewport tag content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void should_add_appShellAnnotations() {
By.cssSelector("meta[name=viewport]"));
Assert.assertNotNull(metaViewPort);
Assert.assertEquals(
"width=device-width, height=device-height, initial-scale=1.0",
"width=device-width, height=device-height, initial-scale=1.0, viewport-fit: cover",
vursen marked this conversation as resolved.
Show resolved Hide resolved
metaViewPort.getAttribute("content"));
}

Expand Down
Loading