diff --git a/src/components/InstallPrompt.vue b/src/components/InstallPrompt.vue index bda4e1f..1e6e1a7 100644 --- a/src/components/InstallPrompt.vue +++ b/src/components/InstallPrompt.vue @@ -51,12 +51,20 @@ const dismissPrompt = () => { deferredPrompt = null } +const handleKeydown = (e) => { + if (e.key === 'Escape' && showInstallPrompt.value) { + dismissPrompt() + } +} + onMounted(() => { window.addEventListener('beforeinstallprompt', handleBeforeInstallPrompt) + window.addEventListener('keydown', handleKeydown) }) onBeforeUnmount(() => { window.removeEventListener('beforeinstallprompt', handleBeforeInstallPrompt) + window.removeEventListener('keydown', handleKeydown) }) diff --git a/src/components/tools/QrScanner.vue b/src/components/tools/QrScanner.vue index 84b24c9..3024662 100644 --- a/src/components/tools/QrScanner.vue +++ b/src/components/tools/QrScanner.vue @@ -377,11 +377,18 @@ watch(scannedCodes, (newVal) => { localStorage.setItem('qr-history', JSON.stringify(newVal)) }, { deep: true }) +const handleKeydown = (e) => { + if (e.key === 'Escape' && isFullscreen.value) { + toggleFullscreen() + } +} + onMounted(() => { checkCameras() loadHistory() window.addEventListener('resize', updateVideoAspect) window.addEventListener('resize', startBackgroundLoop) + window.addEventListener('keydown', handleKeydown) watch(isFullscreen, (fs) => { if (fs) { startBackgroundLoop() @@ -389,13 +396,14 @@ onMounted(() => { stopBackgroundLoop() } }, { immediate: true }) - + startScan() }) onUnmounted(() => { window.removeEventListener('resize', updateVideoAspect) window.removeEventListener('resize', startBackgroundLoop) + window.removeEventListener('keydown', handleKeydown) stopScan() }) diff --git a/src/components/tools/UrlCleanerExceptionsModal.vue b/src/components/tools/UrlCleanerExceptionsModal.vue index c120200..a53ddfb 100644 --- a/src/components/tools/UrlCleanerExceptionsModal.vue +++ b/src/components/tools/UrlCleanerExceptionsModal.vue @@ -1,5 +1,5 @@