specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
61 stars 36 forks source link

Add keyboard shortcuts for common actions #1746

Open maxpatiiuk opened 2 years ago

maxpatiiuk commented 2 years ago

Like this:

To meet the WCAG 2.1 requirements, these shortcuts must be customizable

Implementation idea: Split user preferences into 3 ultra-sections: Options (everything that is not in the next two) Theme (for setting UI colors - and add ability to customize more colors) Keyboard Shortcuts

maxpatiiuk commented 1 year ago

@CarolineDenis This one might be interesting for you

I have the code for the keyboard picker component already written so can push it if you want to work on it The remaining thing would be to create a hook like useKey('category', 'subcategory', 'item', callback) where 'category', 'subcategory', 'item' matches what you see in user prefs, and the callback is a function that will be called by the hook when the user presses the keyboard shortcut.

Edge cases to handle: If user assigned a shortcut like B (without Ctrl/alt/or other modified), than you have to make sure to only trigger the keyboard shortcut if user is not currently typing into a text field

grantfitzsimmons commented 9 months ago
  1. When browsing records in forms view, I miss a keyboard shortcut for moving to the next/previous record.

This would be so nice to have!

Requested By: Eyal at The Hebrew University of Jerusalem

maxpatiiuk commented 3 months ago

Implementation idea: Split user preferences into 3 ultra-sections: Options (everything that is not in the next two) Theme (for setting UI colors - and add ability to customize more colors) Keyboard Shortcuts

I don't think this is the best solution anymore. Better implementation:

grantfitzsimmons commented 3 months ago

yes 100x to @maxpatiiuk 🎉

maxpatiiuk commented 2 months ago

Did a bit of research on this.

Complications:

Going to do a bit of reverse-engineering of Gmail's and Asana's source code to see how they handled these things. Will also look at what Google Sheets and Google Docs are doing since there they have a lot of text entry happening, thus complicating single-letter keyboard shortcuts

For now, I am thinking that:

maxpatiiuk commented 2 months ago

Observations:

maxpatiiuk commented 2 months ago

Started work on this on a branch: https://github.com/specify/specify7/pull/5097

Not completed yet, but if someone is interested, it's good enough now to preview the keyboard setting UI and keyboard shortcuts in action

For now, I only set the shortcuts for going between recordset items and adding a new item - will add several dozen more

My favorite part: the UI displays a hint in the tooltip if a keyboard shortcut is defined for a given action:

Screenshot 2024-07-13 at 19 33 39

lexiclevenger commented 1 month ago

@maxpatiiuk, Corinna P has provided us with feedback on existing keyboard shortcuts and a list of tasks that users at CSIRO would like to see keyboard shortcuts for:

Our Herbarium users are doing large amounts of front-end data entry and have provided us with a bit of feedback regarding the current shortcuts that are available to them, which we wanted to pass on for possible integration into the above GH ticket.

For reference, we have been referring them to the section on shortcuts on this page: https://discourse.specifysoftware.org/t/using-forms-in-specify-7/959  

  • Closing a window should be enabled by using the Esc button. E.g., when you open a sub-form in a new window there should be an option to quickly close it when no editing is required. Currently, you have to tab through all fields to get to the Close button at the bottom of the form.
  • Edit mode shortcut 'toggle'. Users have requested a quick way to turn on/off Edit mode. If you want to go from the CO form to the locality form you currently have to click the Edit button three times. A shortcut would minimise the amount of mouse-work required.
  • Save is inconsistent. The provided shortcut is Ctrl+Enter; this only works in Firefox. We found through trial and error that Shift+Enter works in Chrome and Edge, however, this only works if you are in a non-expandable field. In a note field, for example, it just creates a new line. Noting that in the old herbarium system a save was achieved via F10.
  • Jump between sub-sections in a form. Users would like the ability to jump by section/sub-form. Currently they have to tab through every field to get further get to subsections further down in the form.

(Asana)

maxpatiiuk commented 1 month ago

Closing a window should be enabled by using the Esc button. E.g., when you open a sub-form in a new window there should be an option to quickly close it when no editing is required. Currently, you have to tab through all fields to get to the Close button at the bottom of the form.

I suppose by window this means a dialog? Esc key works to close modal dialogs (those that darken the screen behind them). It's disabled for non-modal dialogs. I believe it's disabled so as to prevent accidental loss of data if you have begun doing some edits in that dialog. Having Esc key work until you made any change in that dialog would be a nice improvement!


Edit mode shortcut 'toggle'. Users have requested a quick way to turn on/off Edit mode. If you want to go from the CO form to the locality form you currently have to click the Edit button three times. A shortcut would minimise the amount of mouse-work required.

Hmm, a bit of clarification on this one would be nice.

to turn on/off Edit mode

A shortcut for toggling the app-wide toggle readonly mode?

If you want to go from the CO form to the locality form you currently have to click the Edit button three times

Or do you mean the small edit button in the query combo box? We could have a shortcut that would "click" on the edit button in the query combo box, but that shortcut would only work if the query combo box is focused - otherwise there could be several query combo boxes on the page, so it wouldn't be clear to specify which one the user means to open.

Or did you mean quickly switching between creating a new Collection Object and creating a new Location? The v1 implementation of keyboard shortcuts will include ability to bind a custom keyboard shortcut for any specify URL, letting you bind a keyboard shortcut for opening the form for creating a new "Locality" for example. Does that work for you, or did I misunderstand the request?

Save is inconsistent. The provided shortcut is Ctrl+Enter; this only works in Firefox. We found through trial and error that Shift+Enter works in Chrome and Edge, however, this only works if you are in a non-expandable field. In a note field, for example, it just creates a new line. Noting that in the old herbarium system a save was achieved via F10.

This is controlled by the browser. The specify form is rendered as a native HTML form and the save button is the submit button - thus whatever is the keyboard shortcut in that browser for submitting the form, that is the behavior Specify uses. We could definitely though let people bind a custom shortcut for saving the form so as to circumvent the differences between browsers.

Jump between sub-sections in a form. Users would like the ability to jump by section/sub-form. Currently they have to tab through every field to get further get to subsections further down in the form

Ah, that's a great idea. What I have already implemented on a branch is a keyboard shortcut for going to first/previous/next/last record. Having a shortcut for moving focus one form section up/down would be a nice feature to have!

CorinnaPaeper commented 1 month ago

Hi @maxpatiiuk . Trying to add some clarifications for you 😊

Windows – I assume window and dialog box are referring to the same thing. What I was referring to was the new window/dialog box that pops up when I open a subform via a button or QCBX. For example, all our collections have shared CEs so we are using the QCBX. When I open the event it shows up as a new window. This can’t be closed other than with the ‘Close’ button at the end of the form.

Edit mode toggle – yes, this is in reference to the app-wide edit mode. We have turned RO-mode by default on for most of our instances now. It would be useful to have a short-cut that lets users toggle quickly between the RO/Edit mode rather than needing to click on the ‘Edit’ button repeatedly. The example provided was just highlighting how much clicking is involved. If you start in the CO, you need to click ‘Edit’ to be able to edit the record. From there, you open the CE, which is in RO-mode when it opens, so need to click ‘Edit’ again. Then you go to Locality, which again opens in RO-mode, so again need to click on ‘Edit’ to be able to modify the record.

Does this help?