Skip to content

fix(action-sheet,camera): show the Cancel action of action sheets on iPhone - #2631

Open
arblitroshani wants to merge 1 commit into
ionic-team:mainfrom
arblitroshani:fix/action-sheet-popover-iphone
Open

arblitroshani wants to merge 1 commit into
ionic-team:mainfrom
arblitroshani:fix/action-sheet-popover-iphone

Conversation

@arblitroshani

@arblitroshani arblitroshani commented Nov 5, 2026 •

Copy link
Copy Markdown

Description

On iPhone, don't call setCenteredPopover for action sheets that have a Cancel action:

  • @capacitor/action-sheet showActions(): when an option has style: ActionSheetButtonStyle.Cancel.
  • @capacitor/camera showPrompt() (CameraSource.Prompt): always, since it always adds a Cancel action.

Other idioms (iPad) keep the centred popover. On iPhone, an action sheet without a Cancel option keeps the popover too. On iOS 26+, cancelable relies on the popover's tap-outside dismissal (#2285), and an unanchored action sheet without a Cancel action can't be dismissed by tapping outside.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation
  • Other (CI, chores, etc.)

Rationale / Problems Fixed

Fixes #2630.

With Liquid Glass (iOS 26+), UIKit presents an anchored .actionSheet as a popover on iPhone too, and popovers hide the .cancel action. setCenteredPopover anchors on every idiom. Before iOS 26, iPhone ignored the anchor.

Tests or Reproductions

Minimal Capacitor 8.6 app with @capacitor/action-sheet and @capacitor/camera installed from this branch, built with Xcode 27.0, on an iPhone 18 Pro simulator with iOS 27.0:

  • showActions() with a Cancel option: before, a popover without Cancel. After, the system action sheet with Cancel. Tapping Cancel or outside resolves with the Cancel option's index.
  • showActions() without a Cancel option, cancelable: true: a popover before and after. Tapping outside resolves with { canceled: true, index: -1 }.
  • getPhoto({ source: CameraSource.Prompt }): before, a popover without Cancel. After, the action sheet with Cancel, which rejects with User cancelled photos app. "From Photos" still continues to the photo library.
  • npm run lint and npm run verify:ios in action-sheet and camera. In camera, prettier --check fails on CameraPlugin.java, which this PR doesn't touch.

Not tested: iPad, iOS 18 and earlier, apps built with Xcode 26.

Screenshots / Media

iPhone 18 Pro simulator, iOS 27.0: 1. action-sheet before, 2. action-sheet after, 3. camera prompt before, 4. camera prompt after.

upstream-ios26-ios27-before-after

Platforms Affected

  • Android
  • iOS
  • Web

Notes / Comments

The same check could live in core setCenteredPopover instead, by looking for a .cancel action in UIAlertController.actions. That would also cover third-party plugins. Happy to move it there if you prefer.

…iPhone

With Liquid Glass (iOS 26+), UIKit presents an action sheet anchored by
setCenteredPopover as a popover on iPhone too, and popovers hide the
.cancel action. Skip the anchor on iPhone when the sheet has a Cancel
action. Without one, keep the popover: tapping outside it is what
cancels the sheet on iOS 26+.

Fixes ionic-team#2630
@arblitroshani
arblitroshani marked this pull request as ready for review November 5, 2026 00:11
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(action-sheet, camera): on iPhone with Liquid Glass, action sheets show as a popover without the Cancel action

1 participant