Skip to content

Add keyboard shortcut help dialog to discover available shortcuts (? key)#68200

Open
choo121600 wants to merge 6 commits into
apache:mainfrom
choo121600:feat/shortcut-registry
Open

Add keyboard shortcut help dialog to discover available shortcuts (? key)#68200
choo121600 wants to merge 6 commits into
apache:mainfrom
choo121600:feat/shortcut-registry

Conversation

@choo121600

Copy link
Copy Markdown
Member

Why

The UI includes many keyboard shortcuts, but there is currently no way to discover them.
This PR adds a help dialog that can be opened with ? and shows the shortcuts available on the current page, grouped by category.

How

Shortcuts register themselves when mounted, so the dialog always reflects the shortcuts that are actually available.
A thin useShortcut wrapper around useHotkeys provides this functionality without changing existing shortcut behaviour.

Screenshot 2026-06-08 at 1 50 14 PM Screenshot 2026-06-08 at 1 50 02 PM
Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

claude opus 4.8


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@bbovenzi

bbovenzi commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Interesting! I think we should get rid of the keyboard tooltip on the Grid view while we are at it then.

Comment thread airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
Comment thread airflow-core/src/airflow/ui/src/hooks/useShortcut.ts Outdated

@bbovenzi bbovenzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Final note. I think we should keep a json file of all the existing shortcuts in one place instead of the useShortcut building the list on render.

A single file source of truth will be much easier for maintainers to know what shortcuts already.

@choo121600

Copy link
Copy Markdown
Member Author

@bbovenzi Just to make sure I understand the suggestion correctly, are you primarily looking for:

  • A single source of truth for shortcut definitions (e.g. a central catalog/JSON file), while keeping the dialog scoped to shortcuts available on the current page?
  • The help dialog itself to always show the complete list of shortcuts, regardless of the current page?

The current implementation intentionally uses the live registry so the dialog only shows shortcuts that are actually available in the current context.

@bbovenzi

bbovenzi commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@bbovenzi Just to make sure I understand the suggestion correctly, are you primarily looking for:

  • A single source of truth for shortcut definitions (e.g. a central catalog/JSON file), while keeping the dialog scoped to shortcuts available on the current page?
  • The help dialog itself to always show the complete list of shortcuts, regardless of the current page?

The current implementation intentionally uses the live registry so the dialog only shows shortcuts that are actually available in the current context.

The first one. I think having a single source of truth in the code would help with maintainability. We can have nested objects in the json block for global vs per page shortcuts though.

@choo121600 choo121600 force-pushed the feat/shortcut-registry branch 2 times, most recently from 79fe957 to 7740a25 Compare June 11, 2026 04:42
@choo121600

Copy link
Copy Markdown
Member Author

How about keeping the catalog as a .ts file instead of JSON?
entries stay type-checked at the definition site (satisfies CategorizedShortcuts), so a typo'd category fails to compile instead of silently dropping the shortcut from the help dialog.

Happy to switch to JSON if you'd prefer, though.

@choo121600 choo121600 marked this pull request as draft June 11, 2026 05:03
@ashb

ashb commented Jun 11, 2026

Copy link
Copy Markdown
Member

An idea: Should the shortcut keys themselves also be localized/translated?

@ashb

ashb commented Jun 11, 2026

Copy link
Copy Markdown
Member

Nit: should the shortcuts we show be scoped down to the current page?

@bbovenzi

Copy link
Copy Markdown
Contributor

@choo121600 yes a ts file works for me.

@choo121600

choo121600 commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

Nit: should the shortcuts we show be scoped down to the current page?

This is already the current behavior :) The modal renders from a live registry rather than the static catalog.
Each useShortcut registers on mount and unregisters on unmount (and is skipped when enabled is false), so the modal only displays shortcuts that are active on the current page.

Dag Page

image

DagRun Page

image

An idea: Should the shortcut keys themselves also be localized/translated?

I'm not sure whether the key combinations themselves should be localized.
Things like Ctrl and Shift are currently part of the translation strings, but when working on the Korean translations I've been keeping them as-is rather than translating them.

@choo121600 choo121600 force-pushed the feat/shortcut-registry branch from 198fb34 to 6219251 Compare June 12, 2026 07:17
@choo121600 choo121600 force-pushed the feat/shortcut-registry branch from 6219251 to a61bbdf Compare June 12, 2026 08:10
@choo121600 choo121600 marked this pull request as ready for review June 12, 2026 11:20
@choo121600 choo121600 force-pushed the feat/shortcut-registry branch from a61bbdf to 40028d1 Compare June 14, 2026 23:36
@choo121600 choo121600 changed the title feat: keyboard shortcuts help dialog (press ?) Add keyboard shortcut help dialog to discover available shortcuts (? key) Jun 16, 2026
@choo121600 choo121600 requested a review from bbovenzi June 17, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants