nextcloud-libraries / nextcloud-libraries/nextcloud-viewer
Keyboard shortcuts were lost in the rewrite
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- Avg merge
- 6h 19m
- Merged PRs (30d)
- 43
Description
The viewer this one replaced bound three shortcuts on window while it was open:
keyboardDeleteFile(event) {
if (this.canDelete && event.key === 'Delete' && event.ctrlKey === true) this.onDelete()
}
keyboardDownloadFile(event) {
if (event.key === 's' && event.ctrlKey === true) { event.preventDefault(); if (this.canDownload) this.onDownload() }
}
keyboardEditFile(event) {
if (event.key === 'e' && event.ctrlKey === true) { event.preventDefault(); if (this.canEdit) this.onEdit() }
}
There is no keyboard handling of any kind in the library now — grep for addEventListener('key, @keydown and useHotKey across lib/ returns nothing.
Worth checking before reimplementing them here: the download and delete actions are rendered from the Files actions registry now rather than being the viewer's own buttons, so those two may already register their own shortcuts. If they do, only edit needs one, and it should be registered the way the rest of the frontend does it rather than as a bare window listener.
Edit also has a condition it did not have before: it is now gated on the file's write permission, so a shortcut has to respect that too.
- Check whether the Files actions already bind Ctrl+S and Ctrl+Delete
- Reimplement what is missing, using the frontend's own hotkey mechanism
- Cover them, in the playground where the actions exist
Found while reading the old viewer for regressions; the others from that pass are fixed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the Files actions registry and the frontend hotkey mechanism, then grep lib/ for existing keyboard handling and check the playground where the actions exist. Verify whether Ctrl+S and Ctrl+Delete are already registered; implement only missing shortcuts, including edit with its write-permission condition. Done means the relevant shortcuts work and are covered in the playground.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100