diff --git a/client/src/components/Form/Elements/FormDirectory.vue b/client/src/components/Form/Elements/FormDirectory.vue index 29f12722a3f..a57ab446ddc 100644 --- a/client/src/components/Form/Elements/FormDirectory.vue +++ b/client/src/components/Form/Elements/FormDirectory.vue @@ -140,12 +140,23 @@ export default { }, addPath({ key }) { if ((key === "Enter" || key === "/") && this.isValidName) { - const newFolder = this.currentDirectoryName; - this.pathChunks.push({ pathChunk: newFolder, editable: true }); - this.currentDirectoryName = ""; + this.addDirectoryToPath(); + } + }, + handleBlur() { + if (this.currentDirectoryName && this.isValidName) { + this.addDirectoryToPath(); + } else { + // If the input was touched let's propagate the change either way. this.updateURL(); } }, + addDirectoryToPath() { + const newFolder = this.currentDirectoryName; + this.pathChunks.push({ pathChunk: newFolder, editable: true }); + this.currentDirectoryName = ""; + this.updateURL(); + }, updateURL(isReset = false) { let url = undefined; if (!isReset) { @@ -159,14 +170,6 @@ export default { } this.$emit("input", url); }, - handleBlur() { - if (this.currentDirectoryName && this.isValidName) { - const newFolder = this.currentDirectoryName; - this.pathChunks.push({ pathChunk: newFolder, editable: true }); - this.currentDirectoryName = ""; - } - this.updateURL(); - }, }, };