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

Allow hotkeys to have multiple alphanumeric keys pressed down at the same time #6938

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

ayxliu19
Copy link
Contributor

@ayxliu19 ayxliu19 commented Aug 9, 2024

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

For my hackweek project, I wanted to implement throughout hotkeys in Apollo for power users. We copied a lot of the hotkeys commonly used in other apps, and one of the common page navigation hotkeys is "g + some character" to denote "Go to some page". For example, if I want to "Go to Dashboard", I would type "g + d".

However, useHotkeys in Blueprint currently does not support having multiple alphanumeric keys pressed down at the same time. This PR changes the key combo to hold a set of keys rather than a singular key and enables this functionality.

DOWNSIDE

The piano example for hotkeys becomes kind of broken with this PR. Now we need to manually encode the combinations of q + w, w + e, etc. Otherwise the example just breaks for multiple hotkey combinations. Currently I added hotkey combinations for q + w and w + e but it doesnt make sense to hardcode each of these because the number of ways to choose 1 - 10 keys out of 24 is 4,687,385.

If the decision is to just disallow pressing multiple keys within this example, I can remove the hotkey combinations for q + w and w + e that I added.

Testing

Added unit tests, can also test using the key-combo-tester

  1. Go to http://localhost:9001/#core/hooks/use-hotkeys.key-combo-tester
  2. Use the key combo tester and verify you can use keys such as "a + b", "g + c", etc.
  3. Also check the piano key example above and ensure that pressing singular keys works as expected.

Screenshot

2024-08-09 12 05 33

@changelog-app
Copy link

changelog-app bot commented Aug 9, 2024

Generate changelog in packages/core/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Allow hotkeys to have multiple alphanumeric keys pressed down at the same time


Generate changelog in packages/docs-app/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Allow hotkeys to have multiple alphanumeric keys pressed down at the same time


Check the box to generate changelog(s)

  • Generate changelog entry

@svc-palantir-github
Copy link

Add generated changelog entries

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

Fix hotkey tests

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

Handle space unit test

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

Fix tester example

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@ayxliu19 ayxliu19 marked this pull request as ready for review August 9, 2024 20:09
@svc-palantir-github
Copy link

Diff

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

Add two multiple key combos on the piano example

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@gluxon gluxon self-assigned this Aug 12, 2024
@gluxon gluxon removed their assignment Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants