Skip to content

Commit

Permalink
fix(tasks): make sure tasks are fully clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
kolaente committed Nov 27, 2023
1 parent f7c06e5 commit 1cbb93e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/components/tasks/partials/singleTaskInProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<div
:class="{'is-loading': taskService.loading}"
class="task loader-container"
@click.stop.self="openTaskDetail"
@mouseup.stop.self="openTaskDetail"
@mousedown.stop.self="focusTaskLink"
ref="taskContainerRef"
tabindex="-1"
>
<fancycheckbox
:disabled="(isArchived || disabled) && !canMarkAsDone"
Expand All @@ -20,6 +23,8 @@
<div
:class="{ 'done': task.done, 'show-project': showProject && project}"
class="tasktext"
@mouseup.stop.self="openTaskDetail"
@mousedown.stop.self="focusTaskLink"
>
<span>
<router-link
Expand Down Expand Up @@ -313,13 +318,24 @@ function hideDeferDueDatePopup(e) {
}
const taskLink = ref<HTMLElement | null>(null)
const taskContainerRef = ref<HTMLElement | null>(null)
function openTaskDetail() {
function hasTextSelected() {
const isTextSelected = window.getSelection().toString()
if (!isTextSelected) {
return !(typeof isTextSelected === 'undefined' || isTextSelected === '' || isTextSelected === '\n')
}
function openTaskDetail() {
if (!hasTextSelected()) {
taskLink.value.$el.click()
}
}
function focusTaskLink() {
if (!hasTextSelected()) {
taskContainerRef.value.focus()
}
}
</script>
<style lang="scss" scoped>
Expand Down

0 comments on commit 1cbb93e

Please sign in to comment.