ionic-team / ionic-team/capacitor

[Bug]: SystemBars omits the iOS statusTap bridge

Open
#8,583 2 comments 1 reaction 0 assignees View on GitHub
triage
Dominant language
TypeScript
Stars
16.7k
Forks
1.3k
Avg merge
3d 15h
Merged PRs (30d)
10

Description

### Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

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

Installed Dependencies:

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

[success] Android looking great! 👌
[success] iOS looking great! 👌

### Other API Details

```Shell
npm --version: 10.9.2
node --version: v22.17.0
pod --version: 1.16.2
```

### Platforms Affected

- [x] iOS
- [ ] Android
- [ ] Web

### Current Behavior

In a Capacitor 8 iOS application using the core SystemBars API, tapping the iOS status bar does not dispatch the established window.statusTap JavaScript event. Consequently, Ionic does not scroll the active ion-content to the top.
This regression appeared after replacing @capacitor/status-bar with the new core SystemBars API during the Capacitor 8 migration.

Environment:
- @capacitor/core: 8.5.0
- @capacitor/ios: 8.5.0
- @ionic/vue: 8.6.7
- UIViewControllerBasedStatusBarAppearance: true
- Status bar visible
- Application uses an ion-app containing a scrollable ion-content

A listener added directly to the window is never invoked:

```
window.addEventListener('statusTap', () => {
console.log('statusTap received')
})
```

The native status-bar tap is still detected by Capacitor iOS and published through Notification.Name.capacitorStatusBarTapped. However, the core SystemBars plugin does not observe that notification or forward it to the web view.

The separate @capacitor/status-bar plugin does perform that forwarding:

`bridge.triggerJSEvent(eventName: "statusTap", target: "window")`

Therefore:
1. With only core SystemBars installed, tapping the iOS status bar produces no statusTap event and the page does not scroll.
2. Installing and registering @capacitor/status-bar restores the event and Ionic scroll-to-top behavior, even when SystemBars remains responsible for styling and edge-to-edge layout.

This means applications must retain the complete legacy Status Bar plugin solely to preserve the iOS tap event, despite migrating status-bar styling and layout to the Capacitor 8 core API.

### Expected Behavior

When using Capacitor 8’s core SystemBars API on iOS, tapping the visible status bar should dispatch one statusTap event on window, preserving the established Capacitor behavior.

This should allow Ionic’s existing hybrid-app handler to scroll the active ion-content to the top without requiring the separate legacy @capacitor/status-bar dependency.

At minimum, if omitting statusTap support from SystemBars is intentional, the System Bars documentation and feature comparison should explicitly state that applications must retain @capacitor/status-bar to preserve iOS status-bar tap and scroll-to-top behavior.

### Project Reproduction

Reproduction to follow

### Additional Information

There is an undocumented feature parity regression between SystemBars and the legacy @capacitor/status-bar plugin.

SystemsBars should either raise the statusTap event to allow iOS scroll-to-top behaviour, or the regression should be documented

As a workaround, the following bare-bones plugin can provide the required behaviour without including the full status-bar plugin

```
import Capacitor
import Foundation

@objc(StatusBarTapPlugin)
final class StatusBarTapPlugin: CAPPlugin, CAPBridgedPlugin {
let identifier = "StatusBarTapPlugin"
let jsName = "StatusBarTap"
let pluginMethods: [CAPPluginMethod] = []

private var statusBarTapObserver: NSObjectProtocol?

override func load() {
statusBarTapObserver = NotificationCenter.default.addObserver(
forName: .capacitorStatusBarTapped,
object: nil,
queue: .main
) { [weak self] _ in
self?.bridge?.triggerJSEvent(eventName: "statusTap", target: "window")
}
}

deinit {
if let statusBarTapObserver {
NotificationCenter.default.removeObserver(statusBarTapObserver)
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the core SystemBars iOS implementation and compare its handling of Notification.Name.capacitorStatusBarTapped with the legacy @capacitor/status-bar plugin. Verify the behavior with a window statusTap listener in an iOS app using SystemBars. Done means tapping the visible status bar dispatches one statusTap event without requiring the legacy plugin.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift, typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.