diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2023-11-08 11:07:10 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-01-31 17:14:53 +0000 |
commit | 02f28508179f80256b349b080090ee5e3b6ec54a (patch) | |
tree | 630f3a921c3f23bc642f41e9b598c7d9097ac1fd /apps/files/src/components/FileEntry/FileEntryActions.vue | |
parent | 4b01ca87a404493083e544c3bf257c8fd4c675d5 (diff) | |
download | nextcloud-server-02f28508179f80256b349b080090ee5e3b6ec54a.tar.gz nextcloud-server-02f28508179f80256b349b080090ee5e3b6ec54a.zip |
fix(files): make sure we focus the parent actions submenu entry
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/src/components/FileEntry/FileEntryActions.vue')
-rw-r--r-- | apps/files/src/components/FileEntry/FileEntryActions.vue | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/files/src/components/FileEntry/FileEntryActions.vue b/apps/files/src/components/FileEntry/FileEntryActions.vue index 1e453fec706..d9d8cefdbad 100644 --- a/apps/files/src/components/FileEntry/FileEntryActions.vue +++ b/apps/files/src/components/FileEntry/FileEntryActions.vue @@ -45,6 +45,7 @@ <!-- Default actions list--> <NcActionButton v-for="action in enabledMenuActions" :key="action.id" + :ref="`action-${action.id}`" :class="{ [`files-list__row-action-${action.id}`]: true, [`files-list__row-action--menu`]: isMenu(action.id) @@ -64,7 +65,7 @@ <!-- Submenu actions list--> <template v-if="openedSubmenu && enabledSubmenuActions[openedSubmenu?.id]"> <!-- Back to top-level button --> - <NcActionButton class="files-list__row-action-back" @click="openedSubmenu = null"> + <NcActionButton class="files-list__row-action-back" @click="onBackToMenuClick(openedSubmenu)"> <template #icon> <ArrowLeftIcon /> </template> @@ -322,6 +323,21 @@ export default Vue.extend({ return this.enabledSubmenuActions[id]?.length > 0 }, + async onBackToMenuClick(action: FileAction) { + this.openedSubmenu = null + // Wait for first render + await this.$nextTick() + + // Focus the previous menu action button + this.$nextTick(() => { + // Focus the action button + const menuAction = this.$refs[`action-${action.id}`][0] + if (menuAction) { + menuAction.$el.querySelector('button')?.focus() + } + }) + }, + t, }, }) |