Skip to content

Commit

Permalink
Merge pull request #43291 from nextcloud/backport/43271/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(user_status): Fix losing focus to body when closing user status modal
  • Loading branch information
JuliaKirschenheuter authored Feb 2, 2024
2 parents 0aa9e2c + 1c9d098 commit a4a6c5f
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
4 changes: 3 additions & 1 deletion apps/user_status/src/UserStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
</NcButton>

<!-- Status management modal -->
<SetStatusModal v-if="isModalOpen" @close="closeModal" />
<SetStatusModal v-if="isModalOpen"
:inline="inline"
@close="closeModal" />
</component>
</template>

Expand Down
20 changes: 20 additions & 0 deletions apps/user_status/src/components/SetStatusModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<template>
<NcModal size="normal"
:name="$t('user_status', 'Set status')"
:set-return-focus="setReturnFocus"
@close="closeModal">
<div class="set-status-modal">
<!-- Status selector -->
Expand Down Expand Up @@ -108,6 +109,18 @@ export default {
},
mixins: [OnlineStatusMixin],

props: {
/**
* Whether the component should be rendered as a Dashboard Status or a User Menu Entries
* true = Dashboard Status
* false = User Menu Entries
*/
inline: {
type: Boolean,
default: false,
},
},

data() {
return {
clearAt: null,
Expand Down Expand Up @@ -156,6 +169,13 @@ export default {

return this.$t('user_status', 'Reset status')
},

setReturnFocus() {
if (this.inline) {
return undefined
}
return document.querySelector('[aria-controls="header-menu-user-menu"]') ?? undefined
},
},

watch: {
Expand Down
4 changes: 2 additions & 2 deletions dist/user-status-modal-8299.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/user-status-modal-8299.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/user_status-menu.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/user_status-menu.js.map

Large diffs are not rendered by default.

0 comments on commit a4a6c5f

Please sign in to comment.