Skip to content

[ios] [screenOrientationPlugin] safe area insets not recalculated after lock orientation change #2566

Description

@GoethelHB

Bug Report

Plugin(s)

"@capacitor/screen-orientation": "^8.0.1",

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 8.4.2
  @capacitor/core: 8.4.2
  @capacitor/android: 8.4.2
  @capacitor/ios: 8.4.2

Installed Dependencies:

  @capacitor/cli: 8.4.1
  @capacitor/android: 8.4.1
  @capacitor/core: 8.4.1
  @capacitor/ios: 8.4.1

[success] iOS looking great! 👌

Platform(s)

iOS

Current Behavior

When you rotate programmatically via .lock() -> requestGeometryUpdate (the interface rotates but WebKit doesn't reliably re-evaluate the [env(safe-area-inset-*)] variables the way it does on a physical rotation — so a webview that was in landscape keeps stale insets after being forced to portrait.

Expected Behavior

After the geometry update completes, force WKWebView.safeAreaInsetsDidChange to fire to make WebKit recompute the CSS safe-area variables — replicating what a physical rotation does.

Code Reproduction

call:
await ScreenOrientation.lock({ orientation: "portrait" });

while being in landscape mode and you can see the issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions