Skip to content

Commit

Permalink
Reset project name text fields if focus is lossed
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnesbitt committed Oct 8, 2024
1 parent 38d2cc9 commit 33f53f3
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions web/src/components/ProjectConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,7 @@ export default {
}
watch(selectedProject, () => {
projectConfigMode.value = "existing";
newProjectName.value = undefined;
projectToDelete.value = undefined;
projectToEdit.value = undefined;
resetProjectEdit();
});
onMounted(() => {
Expand All @@ -217,6 +214,19 @@ export default {
});
});
function resetProjectEdit() {
projectConfigMode.value = "existing";
newProjectName.value = undefined;
projectToDelete.value = undefined;
projectToEdit.value = undefined;
}
function handleEditFocus(focused: boolean) {
if (!focused) {
resetProjectEdit();
}
}
return {
currentTab,
projectConfigMode,
Expand All @@ -242,6 +252,8 @@ export default {
addAllSelectionToProject,
removeProjSelectionFromProject,
updateSelectedProject,
handleEditFocus,
resetProjectEdit,
};
},
};
Expand Down Expand Up @@ -295,7 +307,9 @@ export default {
hide-details
autofocus
@keydown.stop
@keydown.esc="resetProjectEdit"
@keydown.enter="saveProjectName"
@update:focused="handleEditFocus"
/>
<span v-else>{{ title }}</span>
</template>
Expand Down Expand Up @@ -339,7 +353,8 @@ export default {
density="compact"
autofocus
@keydown.enter="create"
@keydown.esc="projectConfigMode = 'existing'"
@keydown.esc="resetProjectEdit"
@update:focused="handleEditFocus"
/>
<v-btn
color="primary"
Expand Down

0 comments on commit 33f53f3

Please sign in to comment.