Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(user_status): Fix losing focus to body when closing user status m…
…odal

Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Feb 2, 2024
commit ac2d5924aaaaaa648bfb0ec6407dc180b4cd3531
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