orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
514 stars 221 forks source link

Show hints for keyboard shortcuts #6306

Closed ebruchez closed 3 months ago

ebruchez commented 5 months ago

We have some keyboard shortcuts, but they are not discoverable.

Some are platform-dependent, but some not. For now, show hints for the platform-independent ones where possible.

ebruchez commented 5 months ago

When showing the hints, we need to show the ones appropriate for the given platform. For example on Apple platforms, we use ⌘Z, while on Windows/Linux we use ⌃Z.

One way to do this would be, on the client, to replace all title="... (⌘Z)" with title="... (⌃Z)". This is assuming that only the modifier changes.

BTW right now, with #5783, we register undo/redo/cut/copy/paste on the client. However, we could have other shortcuts that use the modifiers, so we cannot just hook things up there.

Ideally, we'd like a more general, descriptive way of triggering actions with shortcuts, that can be configured for each client platform. Note that we do not have a use case right now to let admins or users configure their own shortcuts. Very few web apps do this (in fact none comes to mind).

If we are ok, at first, just replacing the modifier with , then a simple query/replace works.

avernet commented 5 months ago

Note that we do not have a use case right now to let admins or users configure their own shortcuts. Very few web apps do this (in fact none comes to mind).

True, the only one that comes to mind is Roam. Regarding use cases, I think they mostly stem from the difficulty of finding keyboard shortcuts that work across platforms, browsers, and keyboard layouts.

For instance, over the years, I've encountered a number of web apps with keyboard shortcuts that worked on Chrome on macOS and Windows, but were unusable on Safari (which is much more restrictive than Chrome regarding which keyboard shortcuts are allowed through to the web app), iPadOS, or ChromeOS (where certain key combinations are reserved by the OS). Similarly, I've heard from people using non-US keyboards about having similar problems with certain web apps.

Allowing users to configure their own shortcuts enables us to ship the product with reasonable defaults that work well on Chrome, Windows, and MacOS with a US keyboard, and lets users change those defaults if they're not usable or convenient on their specific browser/OS/keyboard combination.

However, I agree that having a good set of keyboard shortcuts that work well, say, on Chrome, Windows, and MacOS, is the priority. This should be done before we create a UI that lets users configure their own shortcuts.

Screenshot 2024-05-08 at 10 12 43 AM

ebruchez commented 4 months ago

It would be good if shortcuts associated with triggers could be registered declaratively, either at the XForms level or the XBL level.

For example fr:process-button could:

We have an old fr:button but it is obsolete. Otherwise, it would be good if xf:trigger could do it, but it's easier with XBL.

ebruchez commented 4 months ago
<fr:process-button keyboard-shortcut="⌘⇧Z ⌃Y" name="foo">

The button name could be used to read shortcuts from properties:

<property
    as="xs:string"
    name="oxf.xforms.xbl.fr.process-button.keyboard-shortcut.foo"
    value="⌘⇧Z ⌃Y"/>

A <kbd> element would be output automatically.

ebruchez commented 4 months ago

Done so far:

Remaining tasks:

ebruchez commented 4 months ago
ebruchez commented 3 months ago

Documented