Skip to content

[web] Grow the iOS view when the browser toolbar collapses - #193744

Merged
auto-submit[bot] merged 7 commits into
flutter:masterfrom
flutter-zl:issue_193743_fix
Oct 7, 2026
Merged

auto-submit[bot] merged 7 commits into
flutter:masterfrom
flutter-zl:issue_193743_fix

Conversation

@flutter-zl

Copy link
Copy Markdown
Contributor

Fixes #193743

Problem

On iOS, the full-page Flutter view is sized from documentElement.clientHeight. When the page scrolls and Safari or Chrome collapses its toolbar, the visible area grows but clientHeight keeps the toolbar-expanded height, so the view stays short and the page shows through as a white strip at the bottom.

Fix

On iOS, use visualViewport.height when it is taller than clientHeight and has the same width, and keep clientHeight otherwise, so the view never shrinks and the post-rotation case from #81430 is unchanged. The keyboard inset uses the same height, because a height-only change would report the toolbar's space as an open keyboard.

Demo

Swipe up on an iPhone until the browser toolbar collapses.

Before, with a white strip at the bottom: https://flutter-demo-71-before.web.app
After, with no strip: https://flutter-demo-71-after.web.app

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 2, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team labels Oct 2, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the iOS height calculation in FullPageDimensionsProvider to use a new helper method _iOSHeight, which correctly handles browser toolbar collapsing and orientation changes by comparing the visual viewport and document element dimensions. Corresponding unit tests are added to verify these behaviors on iOS. The review feedback suggests extracting domDocument.documentElement! into a local variable within _iOSHeight to avoid redundant null assertions and improve readability.

@flutter-zl
flutter-zl requested a review from mdebbar October 5, 2026 17:55

@mdebbar mdebbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if this PR also fixes #95010?

@flutter-zl flutter-zl added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 6, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 6, 2026
@auto-submit

auto-submit Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/193744, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@flutter-zl

Copy link
Copy Markdown
Contributor Author

Can you check if this PR also fixes #95010?

I tried #95010 with the sample from the issue on iOS 27 Safari, with the address bar at the bottom: focusing and closing the keyboard, panning the page while the keyboard is open, and as a home-screen web app. The sites are https://flutter-demo-72-before.web.app for master and https://flutter-demo-72-after.web.app for this PR. None of them reproduces the strip, even on master, so I can't verify this PR against it. I left a comment in #95010 (comment).

suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…93744)

Fixes flutter#193743

## Problem
On iOS, the full-page Flutter view is sized from
`documentElement.clientHeight`. When the page scrolls and Safari or
Chrome collapses its toolbar, the visible area grows but `clientHeight`
keeps the toolbar-expanded height, so the view stays short and the page
shows through as a white strip at the bottom.

## Fix
On iOS, use `visualViewport.height` when it is taller than
`clientHeight` and has the same width, and keep `clientHeight`
otherwise, so the view never shrinks and the post-rotation case from
flutter#81430 is unchanged. The keyboard inset uses the same height, because a
height-only change would report the toolbar's space as an open keyboard.

## Demo
Swipe up on an iPhone until the browser toolbar collapses.

Before, with a white strip at the bottom:
https://flutter-demo-71-before.web.app
After, with no strip: https://flutter-demo-71-after.web.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web][iOS] Full-page Flutter view keeps a stale height when the browser toolbar collapses

2 participants