-
-
Notifications
You must be signed in to change notification settings - Fork 844
Display WebView under navigation bar #5010
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
70bf859 to
c47769c
Compare
| val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) | ||
| val bottomInset = if (bottomInsetsApplied) 0 else insets.bottom | ||
|
|
||
| v.updatePadding( | ||
| top = insets.top, | ||
| bottom = bottomInset | ||
| ) | ||
|
|
||
| rootInsets = Insets.of(insets.left, 0, insets.right, insets.bottom - bottomInset) | ||
|
|
||
| WindowInsetsCompat.CONSUMED |
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.
Could make sense to call the default onApplyWindowInsets here so the env is set properly in case the bug is ever fixed in Android
|
I don't want to do too much review while there is no frontend decision, but why is the status bar/top inset excluded? |
|
@jpelgrom From my initial analysis, it turned out that the frontend is not yet adapted to the top insets. Even the iOS app does not draw webview under the status bar(If I haven't missed anything) |
We have decided to accept the overall approach. Just have some nitpicks on the frontend PR
I think the app should provide all the insets and let frontend decide what to do. As long as we are not breaking it, of course |
|
|
||
| binding = ActivityWebviewBinding.inflate(layoutInflater) | ||
|
|
||
| bottomInsetsApplied = serverManager.getServer()?.version?.isAtLeast(2026, 1) == true |
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 server/server version might change after the activity is created, most likely in multi-server scenarios. This will only check the current active server which might break UI if at some point it loads another, older frontend version. Not sure what the best fix is but that scenario should be handled.
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.
Ok, sorry for the delay. I will check what we can do with this.
|
I saw such an article recently https://developer.chrome.com/blog/edge-to-edge Apparently chrome 135 will support EdgeToEdge and CSS env variables. I don't know yet how it will relate to webview |
|
Frontend PR merged. It won't do anything until Android sets the vars but you can test with nightly now |
|
This PR is needed for #5328 |
|
@Gregman-js what needs to be done here ? Also if you could review this PR #5345 it would be of a great help :) |
|
I will rebase and update this PR. |
|
Yes, you are right. We can't render WebView under the status bar because frontend does not support it yet. My frontend PR only adds possibility for it. We have to add top padding (I think this PR does it) or some block above WebView |
|
Closing in favor of #5346 |

Summary
Enable EdgeToEdge on WebViewActivity, show WebView under navigation bar.
Applying insets depend on server release with this changes. We shouldn't display webview under navigation bar before frontend release because some ui elements will overlap with navigation bar.
After releasing this two PR we can even show webview under status bar on Android and iOS in future PR's.
We need to do something in this area because when HA will target api 35 some apis releated to changing status bar and navigation bar color will be not available docs
Screenshots
Left iOS, Right: Android

Any other notes
Dependency: home-assistant/frontend#23811
Related issue: #4547