Skip to content

fix: varinfo drag-select dismiss - #8070

Merged
sid-bruno merged 4 commits into
usebruno:mainfrom
shubh-bruno:fix/variable-info
May 26, 2026
Merged

sid-bruno merged 4 commits into
usebruno:mainfrom
shubh-bruno:fix/variable-info

Conversation

@shubh-bruno

@shubh-bruno shubh-bruno commented May 22, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

  • Bug Fixes
    • Fixed variable-info popup in the code editor from closing when clicking inside the popup area.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The 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.

Changes

CodeMirror Variable Popup Interaction

Layer / File(s) Summary
Popup click handler focus check
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js
Document-click handler now early-returns when document.activeElement is contained within the active popup, avoiding unintended dismissal when the user interacts with popup content.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • usebruno/bruno#7912: Related changes to popup lifecycle and document-click dismissal behavior in brunoVarInfo.js.
  • usebruno/bruno#7907: Similar modifications to CodeMirror variable-info popup click handling to prevent unintended hiding.
  • usebruno/bruno#7818: Adjustments to popup dismissal and pin logic that overlap with this change.

Suggested reviewers

  • sid-bruno
  • bijin-bruno

Poem

A tiny guard, a quiet cheer,
The popup stays when focus is near.
Clicks outside still close the door,
But inside—peace, it hides no more.
Small change, steady behavior, clear.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title 'fix: varinfo drag-select dismiss' directly relates to the core change—preventing tooltip dismissal during drag-select operations on focused inputs.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8cd7c26 and 9cf192e.

📒 Files selected for processing (1)
  • packages/bruno-app/src/utils/codemirror/brunoVarInfo.js

@coderabbitai coderabbitai Bot 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.

♻️ Duplicate comments (1)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js (1)

915-917: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Outside click dismiss is over-blocked when focus stays inside popup.

This early return prevents valid outside-dismiss clicks whenever document.activeElement is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9cf192e and 1e7f92f.

📒 Files selected for processing (1)
  • packages/bruno-app/src/utils/codemirror/brunoVarInfo.js

@shubh-bruno shubh-bruno changed the title fix: tooltip drag-select dismiss fix: varinfo drag-select dismiss May 25, 2026
@sid-bruno
sid-bruno merged commit 2e0094f into usebruno:main May 26, 2026
21 of 24 checks passed
jattsson pushed a commit to jattsson/bruno that referenced this pull request May 26, 2026
abhishekp-bruno pushed a commit to abhishekp-bruno/bruno that referenced this pull request May 29, 2026
sharan-bruno pushed a commit to sharan-bruno/bruno that referenced this pull request Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants