bug(action-sheet, camera): on iPhone with Liquid Glass, action sheets show as a popover without the Cancel action

Abierto
#2,630 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@arblitroshani ya está trabajando en esto.

Desde el 5/11/2026.

  • #2631 de @arblitroshani — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
20/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
ios, swift

Línea de trabajo

Start with ActionSheetPlugin.swift at the showActions() call to setCenteredPopover; the issue also identifies CameraPlugin.swift in showPrompt() and the core CAPPlugin.m helper. Check how the presentation anchor is set for each device idiom, then verify on iPhone and iPad: iPhone should show the Cancel action, while iPad should keep its anchored popover. Pull request #2631 is already open.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

platform: ios

Bug Report

Plugin(s)
  • @capacitor/action-sheet 8.1.1 (also present on main, 8.1.2-nightly-20261104T150902.0 and 9.0.0-dev-2629-20261104T204338.0)
  • @capacitor/camera: same pattern in showPrompt() (CameraSource.Prompt), not reproduced separately
Capacitor Version
Installed Dependencies:

  @capacitor/cli: 8.6.0
  @capacitor/core: 8.6.0
  @capacitor/android: 8.6.0
  @capacitor/ios: 8.6.0
Platform(s)

iOS on iPhone, with the Liquid Glass design.

  • With @capacitor/action-sheet: iOS 27.0 simulator and an iPhone 11 on iOS 27.0.
  • With the plain UIKit snippet below: iOS 26.3 and 27.0 simulators.

I haven't tested iPad. There the anchored popover is the intended presentation.

Current Behavior

ActionSheet.showActions() presents the sheet as a popover instead of the system action sheet. The popover is narrower, has no dimmed background, and has no Cancel button, even when an option has style: ActionSheetButtonStyle.Cancel.

showActions calls setCenteredPopover(alertController) on every device (ActionSheetPlugin.swift#L47). Core's setCenteredPopover (CAPPlugin.m#L149-L155) sets sourceView and sourceRect to the centre of the bridge view, with permittedArrowDirections = 0, regardless of idiom.

Without Liquid Glass, iPhone ignores that anchor. With Liquid Glass, UIKit presents an anchored .actionSheet as a popover on iPhone too, and hides the .cancel action, as it always has for popovers. The helper dates from ionic-team/capacitor#25 (2017), when the anchor only took effect on iPad.

UIDesignRequiresCompatibility = YES doesn't help when building with Xcode 27: our app sets it, yet its Xcode 27 builds use Liquid Glass and show the popover on iOS 27.

Expected Behavior

On iPhone, the system's standard (unanchored) action sheet: a wider card over a dimmed background, with its Cancel action.

The position doesn't change. On iOS 26.3 and 27.0, in an app built with Xcode 27, the system action sheet is centred too, not at the bottom of the screen as before Liquid Glass.

On iPad, the anchored popover stays as it is.

Code Reproduction

Build with Xcode 27, with or without UIDesignRequiresCompatibility, and run on an iPhone or iPhone simulator with iOS 27.

import { ActionSheet, ActionSheetButtonStyle } from '@capacitor/action-sheet';

await ActionSheet.showActions({
  title: 'Photo Options',
  options: [
    { title: 'Upload' },
    { title: 'Share' },
    { title: 'Cancel', style: ActionSheetButtonStyle.Cancel },
  ],
});

The same thing in plain UIKit, to isolate it from Capacitor:

let sheet = UIAlertController(title: "Videos", message: nil, preferredStyle: .actionSheet)
sheet.addAction(UIAlertAction(title: "From Videos", style: .default))
sheet.addAction(UIAlertAction(title: "Record", style: .default))
sheet.addAction(UIAlertAction(title: "Cancel", style: .cancel))
// What setCenteredPopover does:
sheet.popoverPresentationController?.sourceRect = CGRect(x: view.center.x, y: view.center.y, width: 0, height: 0)
sheet.popoverPresentationController?.sourceView = view
sheet.popoverPresentationController?.permittedArrowDirections = []
present(sheet, animated: true)
// iPhone with Liquid Glass: a popover without Cancel.
// Without the 3 anchor lines, or with `sourceView = nil` afterwards: the system action sheet with Cancel.
Other Technical Details

Xcode 27.0 (27A266a). iOS 26.3 and 27.0 simulator runtimes. All builds used Xcode 27 (iOS 27 SDK). Apps built with Xcode 26 without UIDesignRequiresCompatibility are likely affected too, but I haven't checked.

Additional Context

Screenshots of the UIKit snippet, from left to right:

  1. iOS 26.3, anchored like setCenteredPopover
  2. iOS 26.3, the same, then sourceView = nil
  3. iOS 27.0, anchored like setCenteredPopover
  4. iOS 27.0, the same, then sourceView = nil
Image

Possible fixes:

  • Plugins: skip setCenteredPopover for action sheets on iPhone (userInterfaceIdiom == .phone). @capacitor/camera showPrompt() (CameraPlugin.swift#L394) needs the same change.
  • Or core: skip the anchor in setCenteredPopover on iPhone. That also covers third-party plugins that call it.

Keep the anchor on every other idiom: on iPad, presenting an action sheet without one raises an exception.

Workaround in an app: override present(_:animated:completion:) in the CAPBridgeViewController subclass, and on iPhone set popoverPresentationController?.sourceView = nil for UIAlertControllers with .actionSheet style before calling super.

No existing issue found: searched for setCenteredPopover, "action sheet" with "cancel", "popover" and "iOS 26", and "liquid glass".

Lenguaje dominante
Java
Estrellas
688
Forks
691
Merge medio
1 d 15 h
PR fusionados (30 d)
3

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ionic-team/capacitor-plugins

Todos los issues de ionic-team/capacitor-plugins

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.