Skip to content

v6: Add KeycapHint primitive#4277

Merged
trevor-scheer merged 3 commits into
graphiql-6from
trevor/keycap-hint
May 15, 2026
Merged

v6: Add KeycapHint primitive#4277
trevor-scheer merged 3 commits into
graphiql-6from
trevor/keycap-hint

Conversation

@trevor-scheer
Copy link
Copy Markdown
Contributor

Summary

  • New primitive KeycapHint for inline keyboard-shortcut chips.
  • Renders an array of keys as <kbd> elements with the v6 keycap visual.
  • Required ariaLabel ensures every shortcut chip has a screen-reader-readable description.
  • Storybook stories for single, chord-with-modifier, and Run-shortcut variants.
  • Adds @testing-library/react + @testing-library/jest-dom as devDeps; these are the first component unit tests in @graphiql/react.

Test plan

  • Open Storybook Primitives/KeycapHint. Each variant renders with the v6 chip style.
  • Inspect the aria-label on each story root; screen-reader spot-check is optional.

Refs: #4219

A small inline component for keyboard-shortcut chips, used by the
new top bar's command palette and Run buttons. Renders one or
more `<kbd>` elements with the v6 keycap styling. The required
`ariaLabel` prop ensures every chip has a screen-reader-readable
description.

Adds `@testing-library/react` + `jest-dom` to `@graphiql/react`'s
devDependencies to support component unit tests in this package.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

🦋 Changeset detected

Latest commit: eb0ae81

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

- Add `autodocs` to custom-words.txt
- Convert `KeycapHint` stories to render functions so the `.tsx`
  file contains JSX (oxlint rule)
@github-actions
Copy link
Copy Markdown
Contributor

The latest changes of this PR are not available as canary, since there are no linked changesets for this PR.

@trevor-scheer trevor-scheer marked this pull request as ready for review May 15, 2026 06:11
@trevor-scheer trevor-scheer merged commit d4f0268 into graphiql-6 May 15, 2026
13 checks passed
@trevor-scheer trevor-scheer deleted the trevor/keycap-hint branch May 15, 2026 06:12
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.

1 participant