Added hotkeys for priority, delete and favorite on the TaskDetailView #3400

Merged
konrad merged 5 commits from primeapple/frontend:add-hotkeys-for-priority-and-delete into main 2023-05-10 09:14:08 +00:00
3 changed files with 21 additions and 3 deletions

View File

@ -140,6 +140,18 @@ export const KEYBOARD_SHORTCUTS : ShortcutGroup[] = [
title: 'keyboardShortcuts.task.description',
keys: ['e'],
},
{
title: 'keyboardShortcuts.task.priority',
keys: ['p'],
},
{
title: 'keyboardShortcuts.task.delete',
keys: ['shift', 'delete'],
},
{
title: 'keyboardShortcuts.task.favorite',
keys: ['s'],
},
konrad marked this conversation as resolved Outdated

Please format this using tabs so that it's consistent with the rest of the document (why didn't the linter catch it?)

Please format this using tabs so that it's consistent with the rest of the document (why didn't the linter catch it?)

The problem here is, that the .editorconfig actually wants 2 spaces indentation for .json files.

As for the reason why the Linter doesn't catch this:
The lint task in package.json only runs for .vue,.js,.ts files, not for json ones.

I wonder why you haven't set up prettier? Or even better rome (unsure if it works with vue files, tho).

~~The problem here is, that the `.editorconfig` actually wants 2 spaces indentation for `.json` files.~~ ~~As for the reason why the Linter doesn't catch this: The `lint` task in `package.json` only runs for `.vue,.js,.ts` files, not for `json` ones.~~ I wonder why you haven't set up prettier? Or even better [rome](https://rome.tools/) (unsure if it works with `vue` files, tho).

Fixed it :)

Fixed it :)

We have a PR which got kind of stale: #930

Rome looks interesting though!

We have a PR which got kind of stale: https://kolaente.dev/vikunja/frontend/pulls/930 Rome looks interesting though!
],
},
]
]

View File

@ -897,7 +897,10 @@
"color": "Change the color of this task",
"move": "Move this task to another project",
"reminder": "Manage reminders of this task",
"description": "Toggle editing of the task description"
"description": "Toggle editing of the task description",
"delete": "Delete this task",
"priority": "Change the priority of this task",
"favorite": "Mark this task as favorite / unfavorite"
},
"project": {
"title": "Project Views",
@ -1056,4 +1059,4 @@
"frontendVersion": "Frontend Version: {version}",
"apiVersion": "API Version: {version}"
}
}
}

View File

@ -322,6 +322,7 @@
@click="setFieldActive('priority')"
variant="secondary"
icon="exclamation"
v-shortcut="'p'"
primeapple marked this conversation as resolved Outdated

Not important for this small PR, but a general reminder, that we talked about at some other places before:

These shortcuts really should be imported from a central place. That would also be the first step for possible user-customized shortcuts in the future.

Not important for this small PR, but a general reminder, that we talked about at some other places before: These shortcuts really should be imported from a central place. That would also be the first step for possible user-customized shortcuts in the future.
>
{{ $t('task.detail.actions.priority') }}
</x-button>
@ -406,6 +407,7 @@
@click="toggleFavorite"
variant="secondary"
:icon="task.isFavorite ? 'star' : ['far', 'star']"
v-shortcut="'s'"
primeapple marked this conversation as resolved Outdated

The s is for star, since f is already used for files

The `s` is for star, since `f` is already used for `files`

I don't like s for files that much.

Didn't check, but would a for attachments still be free? I don't think that too many users use that shortcut (?).

I don't like `s` for files that much. Didn't check, but would `a` for **attachments** still be free? I don't think that _too_ many users use that shortcut (?).

a is used for assignees.

`a` is used for assignees.

How about using u (upload)

How about using `u` (upload)

I honestly don't care what the hotkeys are. Since Vikunja supports imports from other services, I would just take their hotkeys.

But for now, maybe let's just implement it. I'd rather have bad hotkeys than no hotkeys.

The future would be something like having a "classic" hotkey layout, a "Todoist" inspired one and a custom one.

Are you fine with this?

I honestly don't care what the hotkeys are. Since Vikunja supports imports from other services, I would just take their hotkeys. But for now, maybe let's just implement it. I'd rather have bad hotkeys than no hotkeys. The future would be something like having a "classic" hotkey layout, a "Todoist" inspired one and a custom one. Are you fine with this?
>
{{
task.isFavorite ? $t('task.detail.actions.unfavorite') : $t('task.detail.actions.favorite')
@ -416,6 +418,7 @@
icon="trash-alt"
:shadow="false"
class="is-danger is-outlined has-no-border"
v-shortcut="'Shift+Delete'"

x is eXterminate... Just kidding, thats the hotkey that is used for deletion of a single char in vim.

`x` is eXterminate... Just kidding, thats the hotkey that is used for deletion of a single char in vim.

How about meta + backspace instead?
I would use two keys by intend here, so that there has to be a bit more intend by the user in order to delete a task.

How about `meta` + `backspace` instead? I would use two keys by intend here, so that there has to be a bit more intend by the user in order to delete a task.

I'd really avoid using modifier keys in the browser. It often interferes with browser specific behaviour.

Are you fine with this explanation or do you really want me to change it? :)

I'd really avoid using modifier keys in the browser. It often interferes with browser specific behaviour. Are you fine with this explanation or do you really want me to change it? :)

I think using a single key here is fine since there's a modal requiring a confirmation when deleting a task anyway.

I think using a single key here is fine since there's a modal requiring a confirmation when deleting a task anyway.

@primeapple I talked with @konrad about this. After some consideration we decided on using:

  • shift + delete in general
  • shift + backspace additionally for apple devices (if I'm not mistaken we have a detection helper somewhere)
@primeapple I talked with @konrad about this. After some consideration we decided on using: - `shift` + `delete` in general - `shift` + `backspace` additionally for apple devices (if I'm not mistaken we have a detection helper somewhere)

Thanks for the comment.

I see that this is your repo and I'm just a contributor. Because of that I won't argue to much and accept it. But please please consider the following thoughts:

  • Delete is quite unergonomic to reach compared to the other hotkeys that all rely on a letter. Backspace is not perfect, but would be fine. Why shift as a modifier, tho? Why not CTRL?

  • Why would you differentiate Delete and Backspace based on the OS of the computer?

There are keyboards that don't have the delete key easily reachable (it's on a different layer). The Backspace is almost always there. The x is always there.

As a user I don't want to use obscure hotkeys that are not supported anywhere else. Todoist uses Backspace + CTRL, that's also the one used in Emacs.
Vim uses x or d.

Could you write the reasoning behind your thoughts? As @konrad said before:

I think using a single key here is fine since there's a modal requiring a confirmation when deleting a task anyway.

Thanks for the comment. I see that this is your repo and I'm just a contributor. Because of that I won't argue to much and accept it. But please please consider the following thoughts: - Delete is quite unergonomic to reach compared to the other hotkeys that all rely on a letter. Backspace is not perfect, but would be fine. Why shift as a modifier, tho? Why not `CTRL`? - Why would you differentiate Delete and Backspace based on the OS of the computer? There are keyboards that don't have the delete key easily reachable (it's on a different layer). The Backspace is almost always there. The `x` is always there. As a user I don't want to use obscure hotkeys that are not supported anywhere else. Todoist uses `Backspace` + `CTRL`, that's also the one used in Emacs. Vim uses `x` or `d`. Could you write the reasoning behind your thoughts? As @konrad said before: > I think using a single key here is fine since there's a modal requiring a confirmation when deleting a task anyway.

The problem with keyboard shortcuts is they are hard to change later because once we introduce them, people start to use them and after some time they're in their muscle memory.

Why would you differentiate Delete and Backspace based on the OS of the computer?

I think we should, because people are used to using different keys on different OSes. For example, creating a new folder in Finder on MacOS uses a different shortcut than creating a new folder in MS Explorer.
That's for another PR though. (Todoist does something similar)

Why shift as a modifier, tho? Why not CTRL?

Mostly because shift is not used by the OS already and really unlikely to conflict with something else. Todoist uses shift delete for windows and cmd delete on macos.


To move this PR forward, let's use shift + delete for this and introduce shift + backspace (or something different) for macos in a later PR.

The problem with keyboard shortcuts is they are hard to change later because once we introduce them, people start to use them and after some time they're in their muscle memory. > Why would you differentiate Delete and Backspace based on the OS of the computer? I think we should, because people are used to using different keys on different OSes. For example, creating a new folder in Finder on MacOS uses a different shortcut than creating a new folder in MS Explorer. That's for another PR though. (Todoist [does something similar](https://todoist.com/help/articles/keyboard-shortcuts)) > Why shift as a modifier, tho? Why not CTRL? Mostly because shift is not used by the OS already and really unlikely to conflict with something else. Todoist uses shift delete for windows and cmd delete on macos. --- To move this PR forward, let's use shift + delete for this and introduce shift + backspace (or something different) for macos in a later PR.

I think we should, because people are used to using different keys on different OSes. For example, creating a new folder in Finder on MacOS uses a different shortcut than creating a new folder in MS Explorer.

People are not used to that. They will just try to avoid OSes with other keymaps, that's part of the reasons Apples Eco system is so locking in.

I gave away my mac just because I hated switching between Cmd and Ctrl

However, I changed it. It works, but yeah... I'll not use this hotkey, I'm faster with clicking it, honestly. Maybe if we at least could avoid the confirmation dialog, that would be a start 😄

Let's see that we get customizable shortcuts going.

> I think we should, because people are used to using different keys on different OSes. For example, creating a new folder in Finder on MacOS uses a different shortcut than creating a new folder in MS Explorer. People are not used to that. They will just try to avoid OSes with other keymaps, that's part of the reasons Apples Eco system is so locking in. I gave away my mac just because I hated switching between `Cmd` and `Ctrl` However, I changed it. It works, but yeah... I'll not use this hotkey, I'm faster with clicking it, honestly. Maybe if we at least could avoid the confirmation dialog, that would be a start 😄 Let's see that we get customizable shortcuts going.
>
{{ $t('task.detail.actions.delete') }}
</x-button>