Skip to content

Commit

Permalink
Merge pull request #1075 from nextcloud/backport/1073/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: Fix focus lost to body when closing firstrunwizard
  • Loading branch information
Pytal authored Feb 2, 2024
2 parents 5d266b7 + 7f4a080 commit 7a85f36
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 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
4 changes: 2 additions & 2 deletions js/firstrunwizard-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/firstrunwizard-main.js.map

Large diffs are not rendered by default.

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 7a85f36

Please sign in to comment.