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

fix: keep input focused for new task #2561

Merged
merged 1 commit into from
May 4, 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
3 changes: 2 additions & 1 deletion src/components/HeaderBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ export default {
...this.getAdditionalTaskProperties(),
}
const task = await this.createTask(data)
this.openNewTask(task)
await this.openNewTask(task)
this.newTaskName = ''
this.$refs.input.$refs.inputField.$refs.input.focus()
},

getAdditionalTaskProperties() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/TaskBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ export default {
related: this.task.uid,
...this.getAdditionalTaskProperties(),
})
this.openNewTask(task)
await this.openNewTask(task)
this.newTaskName = ''
// Focus the input field again, in case we clicked on the trailing-icon-button
this.$refs.input.$refs.inputField.$refs.input.focus()
Expand Down
8 changes: 4 additions & 4 deletions src/mixins/openNewTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@

export default {
methods: {
openNewTask(task) {
async openNewTask(task) {
// Only open the details view if there is enough space or if it is already open.
if (this.$route.params !== undefined && (document.documentElement.clientWidth >= 768 || this.$route.params.taskId !== undefined)) {
// Open the details view for the new task
const calendarId = this.$route.params.calendarId
const collectionId = this.$route.params.collectionId
if (calendarId) {
this.$router.push({ name: 'calendarsTask', params: { calendarId, taskId: task.uri } })
await this.$router.push({ name: 'calendarsTask', params: { calendarId, taskId: task.uri } })
} else if (collectionId) {
if (collectionId === 'week') {
this.$router.push({
await this.$router.push({
name: 'collectionsParamTask',
params: { collectionId, taskId: task.uri, collectionParam: '0' },
})
} else {
this.$router.push({ name: 'collectionsTask', params: { collectionId, taskId: task.uri } })
await this.$router.push({ name: 'collectionsTask', params: { collectionId, taskId: task.uri } })
}
}
}
Expand Down
Loading