From 3e275d763839cdaaeff96df9ee8b4633b5b39bdd Mon Sep 17 00:00:00 2001 From: OS-pedrogustavobilro Date: Mon, 16 Dec 2024 16:16:03 +0000 Subject: [PATCH 1/2] fix: Allow action sheet to be cancelable in web To be aligned with Android and iOS platforms --- camera/src/web.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/src/web.ts b/camera/src/web.ts index 10e7e3fad..9c9dfae53 100644 --- a/camera/src/web.ts +++ b/camera/src/web.ts @@ -23,7 +23,7 @@ export class CameraWeb extends WebPlugin implements CameraPlugin { document.body.appendChild(actionSheet); } actionSheet.header = options.promptLabelHeader || 'Photo'; - actionSheet.cancelable = false; + actionSheet.cancelable = true; actionSheet.options = [ { title: options.promptLabelPhoto || 'From Photos' }, { title: options.promptLabelPicture || 'Take Picture' }, From 017ed6a1e444d5772ff47d3b7404273c314fea04 Mon Sep 17 00:00:00 2001 From: OS-pedrogustavobilro Date: Tue, 17 Dec 2024 18:28:05 +0000 Subject: [PATCH 2/2] fix: Listen to cancel event on PWA camera photo prompt Requires https://github.com/ionic-team/pwa-elements/pull/138 --- camera/src/web.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/camera/src/web.ts b/camera/src/web.ts index 9c9dfae53..1870d1a03 100644 --- a/camera/src/web.ts +++ b/camera/src/web.ts @@ -36,6 +36,9 @@ export class CameraWeb extends WebPlugin implements CameraPlugin { this.cameraExperience(options, resolve, reject); } }); + actionSheet.addEventListener('onCanceled', async () => { + reject(new CapacitorException('User cancelled photos app')); + }); } else { this.cameraExperience(options, resolve, reject); }