Skip to content

Conversation

@zamoore
Copy link
Contributor

@zamoore zamoore commented Mar 18, 2025

๐Ÿ“Œ Summary

If merged, this PR adds support for custom keybinding through the extraKeys argument.

๐Ÿ› ๏ธ Detailed description

Many of our consumers code editors have custom keybinding through the extraKeys argument, which was a setting in CodeMirror 5

{{code-mirror
  screenReaderLabel="Namespace definition"
  theme="hashi"
  mode="javascript"
  content=this.definitionString
  onUpdate=this.updateNamespaceDefinition
  autofocus=false
  extraKeys=(hash Cmd-Enter=this.save) <- here
}}

This duplicates that same API but with our CodeMirror 6 implementation.

๐Ÿ”— External links

Jira ticket: HDS-4672


๐Ÿ‘€ Component checklist

๐Ÿ’ฌ Please consider using conventional comments when reviewing this PR.

@zamoore zamoore self-assigned this Mar 18, 2025
@vercel
Copy link

vercel bot commented Mar 18, 2025

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Updated (UTC)
hds-showcase โœ… Ready (Inspect) Visit Preview Mar 18, 2025 8:05pm
hds-website โœ… Ready (Inspect) Visit Preview Mar 18, 2025 8:05pm

@zamoore zamoore marked this pull request as ready for review March 18, 2025 19:52
@zamoore zamoore requested a review from a team as a code owner March 18, 2025 19:52
Copy link
Contributor

@shleewhite shleewhite left a comment

Choose a reason for hiding this comment

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

Looks good, we should recommend in the docs that if they add custom key binding theres a couple things to consider:

  • there should be information visible on the page that lets users know they can use the shortcut
  • they should never use single key shortcuts (ie. 's' to save) because that violates WCAG 2.1.4

@zamoore zamoore merged commit abcabaf into main Mar 20, 2025
16 checks passed
@zamoore zamoore deleted the zamoore/HDS-4672/support-custom-key-commands branch March 20, 2025 17:35
@hashibot-hds hashibot-hds mentioned this pull request Mar 20, 2025
@alex-ju alex-ju added this to the [email protected] milestone Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants