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

Backport of [ui] general keyboard navigation: 1.3.4 release into release/1.3.x #14169

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #14138 to be assessed for backporting due to the inclusion of the label backport/1.3.x.

WARNING automatic cherry-pick of commits failed. Commits will require human attention.

The below text is copied from the body of the original PR.


(Port of #12831 for pre-1.4 release)

A general Keyboard / Keynav service for the Nomad UI

  • This allows Nomad users to navigate and operate their UI by use of keyboard alone and provides powerful defaults to move around:
    • absolute routes (such as g j to go to jobs index),
    • relative routes (such as shift + right-arrow to move to the next subnav section), and
    • dynamic routes (such as shift + 03 to go to the third link in a given list)
  • Creates a new global modal, accessible by pressing ? anyplace in the app
  • Gives users the choice to enable/disable shortcuts, or more advanced, to rebind individual commands to the pattern of their choosing.

Implementation and extension

  • Establishes a keyboard service that emits a consumable buffer array and matchedCommand object
  • Listens for keystrokes in any non-input elements
  • On each keystroke, if the buffer matches a pattern/sequence in keyboard.keyCommands, that command's action is run. These actions can be any function, and are commonly router.transitionTo() objects.
  • Uses Tether to place hints on-screen for when the user holds Shift
  • Shortcuts can be added by use of modifier (such as the Go to ACLs link), or by use of component-level, conditional helper keyboard-commands (for example, how we conditionally add the escape key to Evaluations modal)
  • Buffer clears after 0.75sec or when a successful keyboard command is executed

Side-effects

  • In order to facilitate a u shortcut to "Go up a level" from nested routes, reworked many otherwise-inline subnavs into their own components, such as the plugin subnav
  • In order to work around an Ember Router bug around LinkTos with query properties when deeply nested, invoked the classic linkTo component sparingly

Showing the keyboard modal (user pressed "?"):
image

Showing hints active (user holding "Shift"):
image

@hashicorp-cla
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


temp seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA. If you already have a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

@philrenaud philrenaud merged commit 1bcd163 into release/1.3.x Aug 19, 2022
@philrenaud philrenaud force-pushed the backport/12762-ui-general-keyboard-navigation-134-release/annually-loyal-aardvark branch from d7c35f1 to 1bcd163 Compare August 19, 2022 20:20
@philrenaud philrenaud deleted the backport/12762-ui-general-keyboard-navigation-134-release/annually-loyal-aardvark branch August 19, 2022 20:20
@philrenaud philrenaud restored the backport/12762-ui-general-keyboard-navigation-134-release/annually-loyal-aardvark branch August 19, 2022 20:21
@philrenaud philrenaud deleted the backport/12762-ui-general-keyboard-navigation-134-release/annually-loyal-aardvark branch August 19, 2022 21:03
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants