Skip to content

fix(ui): improve tag suggestions & keyboard handling#997

Merged
perber merged 1 commit into
mainfrom
feature/improve-tag-suggestions-keyboard-handling
May 17, 2026
Merged

fix(ui): improve tag suggestions & keyboard handling#997
perber merged 1 commit into
mainfrom
feature/improve-tag-suggestions-keyboard-handling

Conversation

@perber

@perber perber commented May 17, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 17, 2026 18:13

Copilot AI 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.

Pull request overview

This PR refines two UX behaviors in the wiki editor: (1) it changes how the tag-input suggestion API is queried per variant (browse keeps excluding already-selected tags so co-occurring tags surface; metadata no longer sends the selected list and also drops the per-suggestion count badge), and (2) it adds an opt-in mechanism for fields to allow specific global hotkeys (e.g. Mod+S, Escape) to pass through even when the input/textarea normally swallows them. This is wired into the global HotKeyHandler and the editor's Escape toolbar action via a new isHotkeyAllowedOnElement helper and a data-allow-hotkeys DOM attribute, which the frontmatter panel (tag input and key/value fields) sets to "Mod+KeyS Escape".

Changes:

  • Add isHotkeyAllowedOnElement and consume it in HotKeyHandler and useToolbarActions to let opted-in inputs forward specific hotkeys.
  • Make tag suggestion behavior variant-aware (browse excludes selected, metadata does not) and remove the count badge from suggestion buttons; new inputHotkeys prop forwarded as data-allow-hotkeys.
  • Mark frontmatter tag/key/value inputs with data-allow-hotkeys="Mod+KeyS Escape".

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ui/leafwiki-ui/src/lib/hotkeys.ts New isHotkeyAllowedOnElement helper reading data-allow-hotkeys from the nearest ancestor.
ui/leafwiki-ui/src/components/HotKeyHandler.tsx When focus is in input/select/textarea, allow combo through if the element opts in.
ui/leafwiki-ui/src/features/editor/useToolbarActions.tsx Treat Escape as active when the focused element opts into Escape.
ui/leafwiki-ui/src/components/TagInputWithSuggestions.tsx Variant-aware fetchTags exclusion, removed count badge, new inputHotkeys prop.
ui/leafwiki-ui/src/features/editor/PageFrontmatterPanel.tsx Wire METADATA_ALLOWED_HOTKEYS into tag input and property key/value inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@perber
perber merged commit 421c5ae into main May 17, 2026
7 checks passed
@perber
perber deleted the feature/improve-tag-suggestions-keyboard-handling branch May 17, 2026 18:20
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.

2 participants