Skip to content

fix(status-bar): keep the iOS WebView below the status bar after a full-screen modal - #2626

Open
kidzki wants to merge 1 commit into
ionic-team:mainfrom
kidzki:fix/status-bar-ios-modal-layout
Open

kidzki wants to merge 1 commit into
ionic-team:mainfrom
kidzki:fix/status-bar-ios-modal-layout

Conversation

@kidzki

@kidzki kidzki commented Nov 4, 2026

Copy link
Copy Markdown

Closes #2625

Problem

With overlaysWebView: false, the plugin moves the WebView below the status bar once. After a full-screen modal is dismissed (for example Browser.open()), UIKit sets the root view, which is the WebView, back to the full window bounds. The plugin does not lay out again: handleViewDidAppear calls setOverlaysWebView, which returns early because the value did not change. The page then sits under the status bar until the next rotation.

Change

StatusBar.swift only:

  • While overlaysWebView is false, the plugin observes position and bounds of the WebView layer. When the WebView origin no longer matches the status bar height, the plugin lays out the WebView again and brings the background view to the front. This happens in the same layout pass as the reset, so there is no visible jump.
  • resizeWebView() sets isApplyingLayout while it changes the frame, so the plugin does not react to its own changes.
  • The observer ignores frame changes that keep the origin, such as the height change of @capacitor/keyboard with resize: native.
  • handleViewDidAppear also lays out again, as a fallback for a reset the observer cannot correct.
  • setOverlaysWebView(true) stops the observation, setOverlaysWebView(false) starts it.

No API or configuration change. The change is iOS only.

Testing

Tested with the reproduction from the issue. "Before" is 8.0.4, "After" is this change.

Case Device Before After
Launch iPhone 18 Pro simulator, iOS 27.2 below the status bar below the status bar
Browser.open() full screen, then close iPhone 18 Pro simulator, iOS 27.2 under the status bar below the status bar, no visible jump
Browser.open() full screen, then close iPhone 17 Pro, iOS 27.2 not tested below the status bar
Browser.open() with presentationStyle: 'popover', then close iPhone 18 Pro simulator, iOS 27.2 below the status bar below the status bar
Rotate to landscape and back iPhone 17 Pro, iOS 27.2 not tested below the status bar
Keyboard shown and hidden (@capacitor/keyboard 8.0.6) iPhone 18 Pro simulator, iOS 27.2 not tested below the status bar

Not tested: iPad, StatusBar.hide() and show(), toggling overlaysWebView at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(status-bar): iOS WebView moves under the status bar after a full-screen modal is dismissed

1 participant