diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-04-16 16:47:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 16:47:23 +0200 |
commit | 7e14335d4656d52a63ff3693b5fbc9ef28738236 (patch) | |
tree | 21e37159babf28651b312063428f5fdc029e24fd /apps | |
parent | 2392602c30c02ffe0f585a9c43161a8aff34981d (diff) | |
parent | 7c6e68ebf38c590909cb62f1742f59d12cc9b271 (diff) | |
download | nextcloud-server-7e14335d4656d52a63ff3693b5fbc9ef28738236.tar.gz nextcloud-server-7e14335d4656d52a63ff3693b5fbc9ef28738236.zip |
Merge pull request #44851 from nextcloud/backport/44847/stable28
[stable28] fix(files): Focus filename input in new-node dialog when opened
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/components/NewNodeDialog.vue | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/files/src/components/NewNodeDialog.vue b/apps/files/src/components/NewNodeDialog.vue index 38337ddf4b8..5947334f11b 100644 --- a/apps/files/src/components/NewNodeDialog.vue +++ b/apps/files/src/components/NewNodeDialog.vue @@ -128,14 +128,31 @@ export default defineComponent({ defaultName() { this.localDefaultName = this.defaultName || t('files', 'New folder') }, + + /** + * Ensure the input is focussed even if the dialog is already mounted but not open + */ + open() { + this.$nextTick(() => this.focusInput()) + }, }, mounted() { // on mounted lets use the unique name this.localDefaultName = this.uniqueName - this.$nextTick(() => (this.$refs.input as unknown as ICanFocus)?.focus?.()) + this.$nextTick(() => this.focusInput()) }, methods: { t, + + /** + * Focus the filename input field + */ + focusInput() { + if (this.open) { + this.$nextTick(() => (this.$refs.input as unknown as ICanFocus)?.focus?.()) + } + }, + onCreate() { this.$emit('close', this.localDefaultName) }, |