Repository navigation
fix: varinfo drag-select dismiss - #8070
Conversation
WalkthroughThe document-click handler for the CodeMirror variable-info popup now checks whether the currently active element is inside the popup before proceeding; if so, it returns early, preventing the popup from being unpinned or hidden when users interact with elements within the pinned popup. ChangesCodeMirror Variable Popup Interaction
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/bruno-app/src/utils/codemirror/brunoVarInfo.js`:
- Around line 915-917: The early return using
popup.contains(document.activeElement) prevents legitimate outside-click
dismissals; update the document click handler (the function that references
popup and document.activeElement) to only return when the click target is also
inside the popup — e.g., ensure the handler accepts the click event and change
the guard to something like: return if popup.contains(document.activeElement) &&
popup.contains(event.target); otherwise continue with the outside-dismiss logic
so non-focusable outside clicks still close the popup.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 44377425-9809-4bad-92dc-91df14c09e1c
📒 Files selected for processing (1)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (1)
915-917:⚠️ Potential issue | 🟠 Major | ⚡ Quick winOutside click dismiss is over-blocked when focus stays inside popup.
This early return prevents valid outside-dismiss clicks whenever
document.activeElementis still inside the popup (common after text selection), so the popup can remain pinned unintentionally.Suggested narrow guard
const onDocumentClick = function (e) { - if (popup.contains(document.activeElement)) { + if (popup.contains(document.activeElement) && popup.contains(e.target)) { return; } if (!popup.contains(e.target)) { isPinned = false; hidePopup(); } };Also applies to: 919-922
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/utils/codemirror/brunoVarInfo.js` around lines 915 - 917, The early return using popup.contains(document.activeElement) in the outside-click handler is too broad; change the guard to only short-circuit when the click event is also targeting the popup (e.g., if (popup.contains(document.activeElement) && popup.contains(event.target)) return;) or use event.composedPath().includes(popup) for shadow-DOM-safe checks; update both occurrences of popup.contains(document.activeElement) (the check at lines around 915–917 and the similar one at 919–922) so outside clicks dismiss the popup even when focus remains inside after a selection.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@packages/bruno-app/src/utils/codemirror/brunoVarInfo.js`:
- Around line 915-917: The early return using
popup.contains(document.activeElement) in the outside-click handler is too
broad; change the guard to only short-circuit when the click event is also
targeting the popup (e.g., if (popup.contains(document.activeElement) &&
popup.contains(event.target)) return;) or use
event.composedPath().includes(popup) for shadow-DOM-safe checks; update both
occurrences of popup.contains(document.activeElement) (the check at lines around
915–917 and the similar one at 919–922) so outside clicks dismiss the popup even
when focus remains inside after a selection.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2ba3541a-ee50-418c-8439-3cd99fae6018
📒 Files selected for processing (1)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js
Description
JIRA
Fixes - select the entire value and drag the mouse outside the input field. The popup closes even though the input remains focused.
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit