-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix ha-wa-dialog fullscreen and make alerts not fullscreen #28175
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
Conversation
This reverts commit 57a5b6e.
src/resources/theme/main.globals.ts
Outdated
| --safe-area-inset-bottom: var(--app-safe-area-inset-bottom, env(safe-area-inset-bottom, 0)); | ||
| --safe-area-inset-left: var(--app-safe-area-inset-left, env(safe-area-inset-left, 0)); | ||
| --safe-area-inset-right: var(--app-safe-area-inset-right, env(safe-area-inset-right, 0)); | ||
| --safe-area-inset-top: max(var(--app-safe-area-inset-top, env(safe-area-inset-top, 0)), 0px); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the max? safe area can never be negative right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think this either, this is the main potential fix for iOS (will need testing as I only have android or desktop)
From @piitaya :


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not because of negative margin, Looks like the dialog is push from the bottom (there is a grey bar)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this makes more sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Bram Kragten <[email protected]>
src/components/ha-wa-dialog.ts
Outdated
| min-height: var(--ha-dialog-min-height); | ||
| position: var(--dialog-surface-position, relative); | ||
| margin-top: var(--dialog-surface-margin-top, auto); | ||
| transform: translateX( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to translate the dialog? What are we trying to fix here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The offset of the dialog, say the safe area is this:
--app-safe-area-inset-bottom: 36px;
--app-safe-area-inset-left: 68px;(this is a pixel 10 in landscape, which is the nav bar + camera bump)
Without the transform, the position will stay centered to the screen and not the safe area. This is fine until the space is limited. This is only the case for alert/confirmation boxes, as the standard dialog will fall into fullscreen with padding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But since the position is relative we can simply use top and left to position it? We don't need translate then?
src/dialogs/generic/dialog-box.ts
Outdated
| width: 100%; | ||
| } | ||
| .title.alert { | ||
| margin-left: var(--ha-space-2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use margin inline start



Breaking change
Proposed change
Alert dialogs are no longer fullscreen, safe area bounds are set with max-height/width and transformation
Screenshots using safe areas of:
Android (Pixel 10) - Landscape (left)
Standard wa dialogs:

All safe areas set
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: