diff options
author | Christopher Ng <chrng8@gmail.com> | 2024-02-01 11:37:40 -0800 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2024-02-01 11:37:40 -0800 |
commit | a6fac219ca120b1c2632219833db5e75a70a8d5a (patch) | |
tree | 1bdfb55035e9ac6432091444ada452c6752d7241 /apps/user_status | |
parent | 937a6a84fe9fbdbd8e3494f25d92a4e0fbc76376 (diff) | |
download | nextcloud-server-a6fac219ca120b1c2632219833db5e75a70a8d5a.tar.gz nextcloud-server-a6fac219ca120b1c2632219833db5e75a70a8d5a.zip |
fix(user_status): Fix losing focus to body when closing user status modal
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/user_status')
-rw-r--r-- | apps/user_status/src/UserStatus.vue | 4 | ||||
-rw-r--r-- | apps/user_status/src/components/SetStatusModal.vue | 20 |
2 files changed, 23 insertions, 1 deletions
diff --git a/apps/user_status/src/UserStatus.vue b/apps/user_status/src/UserStatus.vue index d632d58a33c..704629f859f 100644 --- a/apps/user_status/src/UserStatus.vue +++ b/apps/user_status/src/UserStatus.vue @@ -43,7 +43,9 @@ </NcButton> <!-- Status management modal --> - <SetStatusModal v-if="isModalOpen" @close="closeModal" /> + <SetStatusModal v-if="isModalOpen" + :inline="inline" + @close="closeModal" /> </component> </template> diff --git a/apps/user_status/src/components/SetStatusModal.vue b/apps/user_status/src/components/SetStatusModal.vue index d763c094895..4047db23843 100644 --- a/apps/user_status/src/components/SetStatusModal.vue +++ b/apps/user_status/src/components/SetStatusModal.vue @@ -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 --> @@ -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, @@ -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: { |