Skip to content

Commit

Permalink
fix: Fix focus lost to body when closing firstrunwizard
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Feb 2, 2024
1 parent 5d266b7 commit e437fb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion js/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
8 changes: 7 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
size="normal"
:has-next="hasNext"
:has-previous="hasPrevious"
:set-return-focus="setReturnFocus"
@close="close"
@next="goToNextPage"
@previous="goToPreviousPage">
Expand Down Expand Up @@ -110,6 +111,7 @@ export default {
logoURL: imagePath('firstrunwizard', 'nextcloudLogo.svg'),
pageSlideDirection: undefined,
circleSlideDirection: undefined,
setReturnFocus: undefined,
}
},
Expand Down Expand Up @@ -147,14 +149,18 @@ export default {
},
methods: {
open() {
open({ setReturnFocus }) {
if (setReturnFocus) {
this.setReturnFocus = setReturnFocus
}
this.page = 0
this.showModal = true
},
close() {
this.page = 0
this.showModal = false
this.setReturnFocus = undefined
axios.delete(generateUrl('/apps/firstrunwizard/wizard'))
},
Expand Down

0 comments on commit e437fb3

Please sign in to comment.