From 99d0777ed0a5067188487b7c74334ed5a0a0f52a Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Thu, 1 Feb 2024 11:55:53 -0800 Subject: [PATCH] fix: Fix focus lost to body when closing firstrunwizard Signed-off-by: Christopher Ng --- js/about.js | 4 +++- src/App.vue | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/js/about.js b/js/about.js index 9a3209d08..5ddebd941 100644 --- a/js/about.js +++ b/js/about.js @@ -8,7 +8,9 @@ document.addEventListener('DOMContentLoaded', function() { event.stopPropagation(); event.preventDefault(); OCP.Loader.loadScript('firstrunwizard', 'firstrunwizard-main.js').then(function () { - OCA.FirstRunWizard.open(); + OCA.FirstRunWizard.open({ + setReturnFocus: document.querySelector('[aria-controls="header-menu-user-menu"]') ?? undefined, + }); OC.hideMenus(function () { return false; }); diff --git a/src/App.vue b/src/App.vue index d04edc2a7..ffe723ae8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -28,6 +28,7 @@ size="normal" :has-next="hasNext" :has-previous="hasPrevious" + :set-return-focus="setReturnFocus" @close="close" @next="goToNextPage" @previous="goToPreviousPage"> @@ -110,6 +111,7 @@ export default { logoURL: imagePath('firstrunwizard', 'nextcloudLogo.svg'), pageSlideDirection: undefined, circleSlideDirection: undefined, + setReturnFocus: undefined, } }, @@ -147,7 +149,10 @@ export default { }, methods: { - open() { + open({ setReturnFocus }) { + if (setReturnFocus) { + this.setReturnFocus = setReturnFocus + } this.page = 0 this.showModal = true }, @@ -155,6 +160,7 @@ export default { close() { this.page = 0 this.showModal = false + this.setReturnFocus = undefined axios.delete(generateUrl('/apps/firstrunwizard/wizard')) },