fix(ui): improve tag suggestions & keyboard handling#997
Conversation
There was a problem hiding this comment.
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
isHotkeyAllowedOnElementand consume it inHotKeyHandleranduseToolbarActionsto let opted-in inputs forward specific hotkeys. - Make tag suggestion behavior variant-aware (
browseexcludes selected,metadatadoes not) and remove the count badge from suggestion buttons; newinputHotkeysprop forwarded asdata-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.
No description provided.