refactor(copilot): repalce show preset prompt hover with Reverting to… #1924
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
If you have any questions, you can refer to the Contributing Guide
What is the current behavior?
The Copilot preset prompt selection panel (
PresetPromptSelect.vue
) appears automatically whenever the Copilot input field (CopilotInput.vue
) receives focus. This can be intrusive and annoying for users who want to type a message. Additionally, once the panel appears, keyboard navigation (up/down/left/right arrows) does not work because the focus remains in the input field, and there's no dedicated way (like pressingEsc
) to dismiss the panel without selecting an item or clicking outside.Issue Number: None
What is the new behavior?
This PR significantly improves the usability of the Copilot preset prompts:
PresetPromptSelect.vue
) is no longer triggered by focusing the input field. Instead, it appears only when the user types a/
character at the beginning of theCopilotInput.vue
field./
), focus is automatically transferred to the panel itself, allowing users to navigate the preset prompts using the up/down/left/right arrow keys and select with Enter.Esc
key to dismiss the preset prompt panel when it is visible. This clears the input field and hides the panel.CopilotInput.vue
field has been updated across all languages to inform users about the new/
trigger (e.g., "Enter message, use / for preset prompts, ↩︎ to send").This makes accessing preset prompts an explicit action initiated by the user with
/
, enables keyboard accessibility, and provides a standard way to close the panel, leading to a much smoother user experience.Does this PR introduce a breaking change?
Specific Instructions
Reviewers should check:
/
is the first character in the input.Esc
dismisses the panel and clears the input when the panel is visible./
and potentially other text in the input field.Other information
This change modifies
src/components/ai/CopilotInput.vue
to handle the new trigger logic, focus management, andEsc
key binding. It also modifiessrc/components/ai/PresetPromptSelect.vue
to add a method for receiving focus, and updates translations insrc/lang/copilot.ts
.