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

feat(files): add keyboard shortcuts #49432

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Nov 21, 2024

Fix #1444
Fix #30484

1 2
2024-11-29_13-10 2024-11-29_13-10_1
Shortcuts ### Selection - [x] Select all - [x] Unselect all - [x] Select/unselect current file

Actions

  • Open actions menu
  • Cut/copy/paste
  • Delete
  • Favourite/star
  • Rename
  • Toggle sidebar/details

Navigation

  • Go up a folder
  • Navigate through files
  • Open file/folder

Usability

  • Open upload menu
  • Show keyboard shortcuts
  • Switch grid/list view

Later

Status

  • Actions
  • Tests
  • Investigate performance loss while scrolling to file ID

@skjnldsv skjnldsv added this to the Nextcloud 31 milestone Nov 21, 2024
@skjnldsv skjnldsv self-assigned this Nov 21, 2024
@skjnldsv skjnldsv changed the title feat(files): add select/unselect all keyboard shortcut feat(files): add keyboard shortcuts Nov 22, 2024
@skjnldsv skjnldsv force-pushed the feat/files-shortcuts branch 2 times, most recently from 75f8d4b to 1c44235 Compare November 29, 2024 11:03
@skjnldsv

This comment was marked as resolved.

@skjnldsv skjnldsv force-pushed the feat/files-shortcuts branch from f6eb690 to 7a278b6 Compare November 29, 2024 12:11
@skjnldsv skjnldsv marked this pull request as ready for review November 29, 2024 12:13
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Nov 29, 2024
@skjnldsv skjnldsv requested review from artonge, ShGKme, a team, Pytal and sorbaugh and removed request for a team November 29, 2024 12:14
@skjnldsv
Copy link
Member Author

Alright, first PR is ready.
Some more will follow for tests and some tiny changes

ShGKme

This comment was marked as resolved.

@skjnldsv
Copy link
Member Author

Btw, we have useHotKey composable to reuse global shortcuts implementation. It might fix some of the issues and reduce copy-paste like mounted + beforeDestroy hooks.

TIL, thanks :)
Yeah, I just realized the input too!
Btw, we should probably check for role=dialig like I did, instead of .modal-mask
https://github.com/nextcloud/nextcloud-vue/blob/10626766712de1e5858b0f71a9babd552bfa6805/src/composables/useHotKey/index.js#L26

@skjnldsv
Copy link
Member Author

  1. This is not clear for me when a file is in focus and when it is not. For example, for arrows and CTRL+Space hotkeys. Especially because the click on the file executes an action rather than selecting it.

Totally agree! But this is not really related to this PR.
The active file design is already a feature since 28 (the fileid in the URL initiate it)

@skjnldsv skjnldsv force-pushed the feat/files-shortcuts branch from 7a278b6 to 0eaa520 Compare November 29, 2024 14:38
@skjnldsv skjnldsv force-pushed the feat/files-shortcuts branch from 0eaa520 to 4b460ae Compare November 29, 2024 14:49
@skjnldsv skjnldsv force-pushed the feat/files-shortcuts branch from 4b460ae to d33525c Compare December 11, 2024 09:06
prevent: true,
})

useHotKey('ArrowUp', this.onKeyDown, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use an array of expected keys here, since the're sharing the same callback:

Suggested change
useHotKey('ArrowUp', this.onKeyDown, {
useHotKey(['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'], this.onKeyDown, {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm reworking this, I should have adjusted the labels :)
I'll take that comment into consideration though, thanks! 👍

@skjnldsv skjnldsv force-pushed the feat/files-shortcuts branch from 54caf2d to 0862632 Compare December 11, 2024 18:05
@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Dec 11, 2024
@skjnldsv

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗️ In progress
Development

Successfully merging this pull request may close these issues.

Keyboard shortcuts for common actions in Files Keyboard shortcut support
4 participants