Skip to content

Conversation

@ollie299792458
Copy link
Member

@ollie299792458 ollie299792458 commented Nov 25, 2025

Fixes #6693

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

Use key for all non-alt keyboard shortcuts, to respect non-default keyboard layouts. Due to complexities around alt shortcuts, fall back to code for those. For default keyboard layout users, no behaviour changes.

Reviewers should focus on:

The piano widget in hotkeys in the docs.

Screenshot

No user facing changes.

@changelog-app
Copy link

changelog-app bot commented Nov 25, 2025

Generate changelog in packages/core/changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Fix Hotkeys for custom keyboard layouts


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

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Fix Hotkeys for custom keyboard layouts


Check the box to generate changelog(s)

  • Generate changelog entry

@svc-palantir-github
Copy link

Correct comment & add 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

Correct comment & add 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

Comment corrections

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

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

@changelog-app
Copy link

changelog-app bot commented Nov 26, 2025

Successfully generated changelog entries for:

  • packages/core/changelog
  • packages/docs-app/changelog

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.


📋Changelog Preview

🐛 Fixes

  • Fix Hotkeys for custom keyboard layouts (#7659)
  • Fix Hotkeys for custom keyboard layouts (#7659)

Copy link
Contributor

@mm-wang mm-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may need a bit more documentation on the expected behavior here and what the exact change is, not just in code.

combo: "ctrl + B",
group: "Modifier Tests",
label: "Test Ctrl+B",
onKeyDown: () => console.log("Ctrl+B pressed"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I don't think this is sufficient for the documentation - there should be something in the UI denoting the keys pressed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it and add more docs + an example

verifyCombos(tests);
});

it("handles alt modifier with special characters (macOS)", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Do you have additional tests in mind for having an alternate layout and checking keys?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some extra tests

- Test that event.key is used for regular keys (no modifier, Ctrl, Meta, Shift)
- Test that event.code is used for Alt with non-ASCII characters
- Test that event.key is used for Alt when character is normal ASCII
- Verifies correct code vs key usage depending on modifier type
@svc-palantir-github
Copy link

Add tests for keyboard layout support with different modifiers

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

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

ollie299792458 and others added 3 commits November 27, 2025 15:23
- Renamed from HotkeyModifierTestExample to HotkeyModifierExample
- Simplified to colored callouts (blue → green when triggered)
- Positioned after piano example on hotkeys pages
- Uses global hotkeys with group for dialog visibility
- Tests modifier combinations: B, Ctrl+B, Shift+B, Alt+B, Meta+B

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Removed modifier test hotkeys from HotkeysTargetExample (redundant with HotkeyModifierExample)
- Renamed TestCallout to ModifierCallout for clarity
- Tests verify key vs code usage correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@svc-palantir-github
Copy link

Clean up examples and rename component

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

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

Reorder style object keys to be in alphabetical order as required by the sort-keys eslint rule.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@svc-palantir-github
Copy link

Fix lint error: sort object keys in hotkeyModifierExample

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

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

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.

useHotkeys inaccurately infers characters, breaking alternate layouts, hurting accessibility and localisation

4 participants