Skip to content

Keyboard shortcuts were lost in the rewrite #2

Description

@skjnldsv

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI assistedstatus: triageNeeds triage - check if valid and reproducibletype: bug🐛 Something isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions