iOS(statusbar): `resizeWebView` shifts the web view down in resizable iPadOS 26 windows (`overlaysWebView: true`)

未关闭 适合新手
#2,639 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
70/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
ios, swift
领域
mobile

调研方向

Issue指出 StatusBar.resizeWebView() 是入口点,并包含覆盖模式的偏移逻辑。阅读该方法及其周围的 iOS 状态栏代码,然后检查相关的 iOS 测试,或为顶部安全区域为 10 pt 的可调整大小窗口添加测试覆盖。完成标准是:调整大小后,覆盖模式仍使 WebView 保持在 y = 0,且上方不留下状态栏。

由索引模型根据 Issue 内容生成。

描述

triage

Plugin version: @capacitor/status-bar 8.0.4 (same code on 8.0.5 nightly), @capacitor/ios 8.6.0, iPadOS 26, app built with the iOS 26 SDK.

What happens
With overlaysWebView: true, after resizing the app window on iPad (windowed apps / Stage Manager) to a window that does not reach full height, a bar appears at the top of the window above the web view (black: the window background).

Cause
StatusBar.resizeWebView() runs 0.1 s after every viewWillTransition and, in overlay mode, does:

let safeAreaTop = webView.safeAreaInsets.top
if statusBarHeight >= safeAreaTop && safeAreaTop > 0 {
    webViewFrame.origin.y = safeAreaTop == 40 ? 20 : statusBarHeight - safeAreaTop
}

In a resizable iPadOS 26 window, statusBarManager.statusBarFrame stays 32 pt, while the window's top safe area is 10 pt for windows that are not full height (32 pt only at full height). The web view is moved to y = 22 and shortened by 22 pt. Measured on device:

window.frame=(0, 0, 1296, 787.5) window.safeArea.top=10 statusBarFrame.height=32
webView.frame (0, 0, 1296, 787.5) -> (0, 22, 1296, 765.5)

Proposed fix
In overlay mode the web view should cover the view controller's whole area; the page handles safe areas itself. The offset only served the pre-iOS 13 double-height status bar, which no supported iOS version has. Set origin.y = 0 for overlay mode.

主要语言
Java
星标
688
派生
690
平均合并
16 小时 15 分钟
30 天内合并 PR
7

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ionic-team/capacitor-plugins 的其他 Issue

查看 ionic-team/capacitor-plugins 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。