Skip to content

Commit e437fb3

Browse files
committed
fix: Fix focus lost to body when closing firstrunwizard
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent 5d266b7 commit e437fb3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

js/about.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ document.addEventListener('DOMContentLoaded', function() {
88
event.stopPropagation();
99
event.preventDefault();
1010
OCP.Loader.loadScript('firstrunwizard', 'firstrunwizard-main.js').then(function () {
11-
OCA.FirstRunWizard.open();
11+
OCA.FirstRunWizard.open({
12+
setReturnFocus: document.querySelector('[aria-controls="header-menu-user-menu"]') ?? undefined,
13+
});
1214
OC.hideMenus(function () {
1315
return false;
1416
});

src/App.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
size="normal"
2929
:has-next="hasNext"
3030
:has-previous="hasPrevious"
31+
:set-return-focus="setReturnFocus"
3132
@close="close"
3233
@next="goToNextPage"
3334
@previous="goToPreviousPage">
@@ -110,6 +111,7 @@ export default {
110111
logoURL: imagePath('firstrunwizard', 'nextcloudLogo.svg'),
111112
pageSlideDirection: undefined,
112113
circleSlideDirection: undefined,
114+
setReturnFocus: undefined,
113115
}
114116
},
115117
@@ -147,14 +149,18 @@ export default {
147149
},
148150
149151
methods: {
150-
open() {
152+
open({ setReturnFocus }) {
153+
if (setReturnFocus) {
154+
this.setReturnFocus = setReturnFocus
155+
}
151156
this.page = 0
152157
this.showModal = true
153158
},
154159
155160
close() {
156161
this.page = 0
157162
this.showModal = false
163+
this.setReturnFocus = undefined
158164
axios.delete(generateUrl('/apps/firstrunwizard/wizard'))
159165
},
160166

0 commit comments

Comments
 (0)