You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AppLayout marginals look broken on iPhone 15 #8449
The UX seems to be non-optional when a Vaadin PWA (using AppLayout) is used on modern iPhone. The bottom of the screen is these days rounded and contains the "home swipe icon". Thus the bottom bar has quite little room for view title and buttons/icons. This is not only causing visual issues, but it is also hard to hit the "hamburger icon" in the bottom left corner.
In the attached screenshot it actually looks better than in real life, as the screenshot includes the "hidden pixels" because of rounded screen, but the "home swipe icon" is there. In iPhone, the hamburger icon is right at the edge of the screen and the visible focus ring is cut in half.
Expected outcome
There should be more marginal for iPhones and other modern smartphones with curved screens.
Minimal reproducible example
Create an app from start.vaadin.com with AppLayout.
AppLayout should be using the `safe-area-inset-bottom´ environment property to determine how far from the viewport bottom its contents should be. Perhaps that's not working as expected.
It's debatable whether this should be considered a regression after all. Its behavior is now very similar to how it has always been in iOS Safari:
PWA
Safari
Replacing height: 100% with height: 100vh changes the behavior in both PWA and iOS Safari, resulting in a more visually appealing outcome:
PWA
Safari
However, given that it affects both, I'm more inclined to consider it a separate issue where a fix that could potentially be breaking for some applications.
Here’s what I’ve written down and implemented in StarPass:
/* Using 100% doesn't cover the entire screen on fullscreen iOS mode (home screen app) *//* 100vh (and 100lvh) breaks normal iOS Safari layout (too high). 100svh is too short in fullscreen apps. *//* 100dvh doesn't seem to work in first render, and is still too short */@media all and(display-mode: standalone){html{height:100lvh;}}
However, given that it affects both, I'm more inclined to consider it a separate issue where a fix that could potentially be breaking for some applications.
I consider the current behavior (height: 100vh in index.html) as a bug, as a full sized layout isn't working as expected in iOS Safari. But yeah, it’s probably a separate issue from this viewport and safe area topic.
One problem that I faced recently (Slack thread) is that with height: 100vh, layouts behave somewhat unexpectedly, e.g. VerticalLayout doesn’t take 100% of page height when setHeightFull() because it inherits the height from parent AppLayout and uses that, instead of having its height defined by the content. In this case 100% would work better.
I don't really understand why this would not be considered a regression 🤷♂️ If I now update to latest, my content is clipped and there is scrollable area as there previosly was not. With older versions it is not, like in my screenshots and those from @vursen. I'd assume also e.g. a view with grid to now have fairly broken UX with 24.6.5, or anything with something draggable&full height on the screen.
As this proabably will be hit by others than just me as well, here is my workaround derived based on the tips by @jouni. Disclaimer: I haven't checked if this now breaks something e.g. with Android phones, maybe jouni remembers something from StarPass tunings? The odd looking marginal for the "bottom bar" is still there, but functionality is now better and the regression is fixex.
public class Application implements AppShellConfigurator, IndexHtmlRequestListener {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
public void configurePage(AppShellSettings settings) {
AppShellConfigurator.super.configurePage(settings);
}
@EventListener
public void hookHacks(ServiceInitEvent event) {
event.addIndexHtmlRequestListener(this);
}
@Override
public void modifyIndexHtmlResponse(IndexHtmlResponse indexHtmlResponse) {
indexHtmlResponse.getDocument().head().append("""
<style>
html, body, #outlet { height: 100%; }
</style>
""");
}
}
Probably doing similar change to index.html file works as well, but I don't have that (as the file says it is autogenerated and I (generally) want to get the latest from the release and keep my project as clean as possible.
Alternative solution is to rever the regressing viewport change (but then the hamburger menu toggle is again "too much in the corner" and the marginals look broken in a different way.
I tried to find a way to adjust the marginals in the "bottom navbar mode", but my CSS skills just wasn't enough. The following pretty much fixes it for iOS PWA, but then it looks crap in non-PWA and event on desktop (and probably on PWA on devices without these new fancy rounded corners). vaadin.com/docs suggests using vaadin-app-layout::part(navbar bottom), which doesn't seem to stick (bottom is an attribute, not part name 🤔), but even then I couldn't yet distinguish the PWA from others :
Activity
yuriy-fix commentedon Jan 9, 2025
We need to check if iphone safe area is calculated properly within app-layout.
rolfsmeds commentedon Jan 9, 2025
AppLayout should be using the `safe-area-inset-bottom´ environment property to determine how far from the viewport bottom its contents should be. Perhaps that's not working as expected.
Possibly related: safe-area-inset-bottom
vursen commentedon Jan 13, 2025
I tested the app-layout on iPhone 13 Pro and didn't notice any issues:
ScreenRecording_01-13-2025.14-42-41_1.MP4
Does it look different on iPhone 15?
UPD: My bad, I missed that it required installing the app as a PWA. I can confirm the issue now.
vursen commentedon Jan 13, 2025
Adding
viewport-fit=coverto<meta name="viewport">seems to fix the issue on iOS.fix: set viewport-fit=cover to enable CSS env() variables in PWAs (#2…
fix: set viewport-fit=cover to enable CSS env() variables in PWAs (#2…
fix: set viewport-fit=cover to enable CSS env() variables in PWAs (#2…
12 remaining items
vursen commentedon Feb 7, 2025
I agree that it looks slightly vertically misaligned now. Could you please share your example with the map component?
mstahv commentedon Feb 7, 2025
Yeah, it may be now technically center in the "allowed area", but looks weird.
I don't you want the map component (Maplibre, check directory) to complicate. Probably component with "full height" will do.
Installed iOs simulator from Xcode so it is easier to take screenshots 😎
jouni commentedon Feb 10, 2025
Is the issue now that the blue rectangles are underneath the navbar?
mstahv commentedon Feb 10, 2025
The problem is that 100% height component is more than 100% and then clipped (regression once this fix is really going to be landed).
vursen commentedon Feb 11, 2025
Thanks, confirmed. The issue is caused by the use of
100vhinstead of100%inindex.html.vursen commentedon Feb 11, 2025
It's debatable whether this should be considered a regression after all. Its behavior is now very similar to how it has always been in iOS Safari:
Replacing
height: 100%withheight: 100vhchanges the behavior in both PWA and iOS Safari, resulting in a more visually appealing outcome:However, given that it affects both, I'm more inclined to consider it a separate issue where a fix that could potentially be breaking for some applications.
jouni commentedon Feb 12, 2025
Here’s what I’ve written down and implemented in StarPass:
In addition to that, index.html has
jouni commentedon Feb 12, 2025
I consider the current behavior (
height: 100vhin index.html) as a bug, as a full sized layout isn't working as expected in iOS Safari. But yeah, it’s probably a separate issue from this viewport and safe area topic.web-padawan commentedon Feb 12, 2025
One problem that I faced recently (Slack thread) is that with
height: 100vh, layouts behave somewhat unexpectedly, e.g.VerticalLayoutdoesn’t take 100% of page height whensetHeightFull()because it inherits the height from parentAppLayoutand uses that, instead of having its height defined by the content. In this case100%would work better.rolfsmeds commentedon Feb 12, 2025
Apparently
dvhnot working correctly is/was a known issue in iOS, but is allegedly fixed in 17.4 https://stackoverflow.com/a/76303978/298103mstahv commentedon Feb 17, 2025
I don't really understand why this would not be considered a regression 🤷♂️ If I now update to latest, my content is clipped and there is scrollable area as there previosly was not. With older versions it is not, like in my screenshots and those from @vursen. I'd assume also e.g. a view with grid to now have fairly broken UX with 24.6.5, or anything with something draggable&full height on the screen.
As this proabably will be hit by others than just me as well, here is my workaround derived based on the tips by @jouni. Disclaimer: I haven't checked if this now breaks something e.g. with Android phones, maybe jouni remembers something from StarPass tunings? The odd looking marginal for the "bottom bar" is still there, but functionality is now better and the regression is fixex.
Probably doing similar change to index.html file works as well, but I don't have that (as the file says it is autogenerated and I (generally) want to get the latest from the release and keep my project as clean as possible.
Alternative solution is to rever the regressing viewport change (but then the hamburger menu toggle is again "too much in the corner" and the marginals look broken in a different way.
mstahv commentedon Feb 17, 2025
I tried to find a way to adjust the marginals in the "bottom navbar mode", but my CSS skills just wasn't enough. The following pretty much fixes it for iOS PWA, but then it looks crap in non-PWA and event on desktop (and probably on PWA on devices without these new fancy rounded corners). vaadin.com/docs suggests using
vaadin-app-layout::part(navbar bottom), which doesn't seem to stick (bottom is an attribute, not part name 🤔), but even then I couldn't yet distinguish the PWA from others :Some JS hack maybe 😢
vursen commentedon Mar 13, 2025
Closing this issue as completed. The page height issue will be addressed in vaadin/flow#21024.