Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] fix(files): move focus to sidebar on open #43448

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion apps/files/src/components/FileEntry/FileEntryActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<NcActions ref="actionsMenu"
:boundaries-element="getBoundariesElement"
:container="getBoundariesElement"
:disabled="isLoading || loading !== ''"
:force-name="true"
type="tertiary"
:force-menu="enabledInlineActions.length === 0 /* forceMenu only if no inline actions */"
Expand Down Expand Up @@ -272,6 +271,11 @@ export default Vue.extend({
},
async onActionClick(action, isSubmenu = false) {
// Skip click on loading
if (this.isLoading || this.loading !== '') {
return
}
// If the action is a submenu, we open it
if (this.enabledSubmenuActions[action.id]) {
this.openedSubmenu = action
Expand Down
25 changes: 16 additions & 9 deletions apps/files/src/views/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
ref="sidebar"
v-bind="appSidebar"
:force-menu="true"
tabindex="0"
@close="close"
@update:active="setActiveTab"
@[defaultActionListener].stop.prevent="onDefaultAction"
Expand Down Expand Up @@ -470,6 +469,10 @@ export default {
throw new Error(`Invalid path '${path}'`)
}
// Only focus the tab when the selected file/tab is changed in already opened sidebar
// Focusing the sidebar on first file open is handled by NcAppSidebar
const focusTabAfterLoad = !!this.Sidebar.file
// update current opened file
this.Sidebar.file = path
Expand All @@ -488,19 +491,23 @@ export default {
view.setFileInfo(this.fileInfo)
})
this.$nextTick(() => {
if (this.$refs.tabs) {
this.$refs.tabs.updateTabs()
}
this.setActiveTab(this.Sidebar.activeTab || this.tabs[0].id)
})
await this.$nextTick()
this.setActiveTab(this.Sidebar.activeTab || this.tabs[0].id)
this.loading = false
await this.$nextTick()
if (focusTabAfterLoad) {
this.$refs.sidebar.focusActiveTabContent()
}
} catch (error) {
this.loading = false
this.error = t('files', 'Error while loading the file data')
console.error('Error while loading the file data', error)
throw new Error(error)
} finally {
this.loading = false
}
},
Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-sidebar.js.map

Large diffs are not rendered by default.

Loading