Skip to content

fix(copilot): copilot shortcut conflict#3219

Merged
waleedlatif1 merged 2 commits intostagingfrom
cursor/copilot-shortcut-conflict-56f0
Feb 18, 2026
Merged

fix(copilot): copilot shortcut conflict#3219
waleedlatif1 merged 2 commits intostagingfrom
cursor/copilot-shortcut-conflict-56f0

Conversation

@emir-karabeg
Copy link
Collaborator

Summary

This PR resolves an issue where Copilot's keyboard shortcuts (1-9 and Enter for option selection/confirmation) were triggering globally, even when the Copilot panel was not the active tab. The fix ensures these shortcuts are only active when the Copilot panel is currently selected.

Fixes # (issue)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

To test this change, navigate to a workflow, open the Copilot panel, and observe that the 1-9 and Enter keys correctly interact with Copilot options. Then, switch to another panel (e.g., Editor) and verify that pressing 1-9 or Enter no longer triggers actions within the Copilot panel.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos


Slack Thread

Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Feb 14, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 17, 2026 6:08pm

Request Review

@waleedlatif1 waleedlatif1 changed the title Copilot shortcut conflict fix(copilot): copilot shortcut conflict Feb 16, 2026
@waleedlatif1 waleedlatif1 marked this pull request as ready for review February 16, 2026 07:38
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 16, 2026

Greptile Summary

This PR fixes a bug where the Copilot's OptionsSelector keyboard shortcuts (1-9 for option selection, Enter for confirmation, and arrow keys for navigation) were captured globally via document.addEventListener('keydown', ...), even when the Copilot panel was not the active tab. The fix subscribes to usePanelStore's activeTab state and adds an early return guard (if (activeTab !== 'copilot') return) inside the keydown handler, ensuring shortcuts only fire when the Copilot tab is selected.

  • Added usePanelStore import alongside existing useCopilotStore import from @/stores/panel
  • Subscribed to activeTab via usePanelStore((s) => s.activeTab) inside OptionsSelector
  • Added activeTab !== 'copilot' guard in the handleKeyDown callback
  • Correctly added activeTab to the useEffect dependency array

Confidence Score: 5/5

  • This PR is safe to merge — it adds a simple, well-scoped guard to prevent keyboard shortcuts from firing when the copilot panel is not active.
  • The change is minimal (4 lines of meaningful code), uses an existing well-tested store (usePanelStore), correctly updates the dependency array, and addresses a clear bug. The activeTab value is a simple string comparison with no risk of side effects. No new dependencies, no architectural changes, and no risk of regression.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx Added activeTab check from usePanelStore to guard keyboard shortcut handler in OptionsSelector, preventing shortcuts from firing when copilot panel is inactive. Clean, minimal fix with correct dependency array update.

Flowchart

flowchart TD
    A[User presses key 1-9 / Enter / Arrow] --> B{keydown event on document}
    B --> C{e.defaultPrevented?}
    C -->|Yes| D[Return - do nothing]
    C -->|No| E{activeTab === 'copilot'?}
    E -->|No| D
    E -->|Yes| F{Input/Textarea focused?}
    F -->|Yes| D
    F -->|No| G{Which key?}
    G -->|1-9| H[Select option directly]
    G -->|Arrow Up/Down| I[Navigate options]
    G -->|Enter| J[Confirm hovered option]
Loading

Last reviewed commit: 170367c

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

… inactive

The OptionsSelector component was capturing keyboard events (1-9 number keys and Enter)
globally on the document, causing accidental option selections when users were
interacting with other parts of the application.

This fix adds a check to only handle keyboard shortcuts when the copilot panel
is the active tab, preventing the shortcuts from interfering with other workflows.

Co-authored-by: Emir Karabeg <[email protected]>
@waleedlatif1 waleedlatif1 force-pushed the cursor/copilot-shortcut-conflict-56f0 branch from 170367c to a79eb6e Compare February 17, 2026 18:07
@waleedlatif1 waleedlatif1 merged commit eab01e0 into staging Feb 18, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the cursor/copilot-shortcut-conflict-56f0 branch February 18, 2026 02:47
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.

3 participants

Comments