Skip to content

fix(dev-tools): console and network filter dropdown scroll - #8613

Closed
sachin-thakur-bruno wants to merge 5 commits into
usebruno:release/v4.1.0from
sachin-thakur-bruno:fix/console-network-tabs-scroll
Closed

sachin-thakur-bruno wants to merge 5 commits into
usebruno:release/v4.1.0from
sachin-thakur-bruno:fix/console-network-tabs-scroll

Conversation

@sachin-thakur-bruno

@sachin-thakur-bruno sachin-thakur-bruno commented Jul 15, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The filter dropdowns in the Console and Network tabs were being clipped by parent containers with overflow: hidden, making options inaccessible when the console panel was small or near the bottom of the viewport.

JIRA

Console/FilterDropdown/index.js (new file)

Extracted FilterDropdown and NetworkFilterDropdown into their own file. Also contains:

  • LogIcon — local icon component for log type indicators
  • computeMenuStyle — shared helper that computes top, right, maxHeight from the trigger's bounding rect

Console/StyledWrapper.js

Added PortalDropdownMenu as a named export — a standalone styled component with all dropdown styles. Required because the portal renders outside StyledWrapper, so nested CSS selectors no longer apply.

Console/index.js

  • Removed FilterDropdown and NetworkFilterDropdown definitions
  • Imports both from ./FilterDropdown
  • Cleaned up unused icon imports (IconFilter, IconChevronDown)
BEFORE AFTER
image image
Screen.Recording.2026-06-12.at.4.40.10.PM.mov

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

  • New Features
    • Added shared dropdown filter menus for developer tool console log types and network request methods.
    • Filter menus show active/total counts and include “Show All” / “Hide All” controls.
    • Menus use a portal-style overlay for more consistent layering and positioning.
  • Bug Fixes
    • Dropdowns now maintain correct placement while resizing and close reliably when clicking outside.
    • Updated styling to improve dropdown appearance, scrolling, and log severity color consistency.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4ea98bce-e688-4241-b72c-53080ff6cc0b

📥 Commits

Reviewing files that changed from the base of the PR and between dcf8850 and 6c644ae.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.js
  • packages/bruno-app/src/components/Devtools/Console/StyledWrapper.js
  • packages/bruno-app/src/components/Devtools/Console/index.js
  • packages/bruno-app/src/hooks/useClickOutside.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/bruno-app/src/hooks/useClickOutside.js
  • packages/bruno-app/src/components/Devtools/Console/StyledWrapper.js

Walkthrough

The console and network devtools filter controls now share an extracted portal-based dropdown, reusable outside-click handling, and themed menu styling. Console severity icons and filter counts are rendered through the shared component.

Changes

Console filter dropdowns

Layer / File(s) Summary
Outside-click hook
packages/bruno-app/src/hooks/useClickOutside.js
Adds a reusable hook that closes registered elements on outside mousedown events while retaining the latest callback.
Shared filter dropdown
packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.js, packages/bruno-app/src/components/Devtools/Console/index.js
Extracts console and network filtering into a shared portal-based dropdown with placement, resize handling, toggle-all controls, counts, and reusable LogIcon rendering.
Portal menu styling
packages/bruno-app/src/components/Devtools/Console/StyledWrapper.js
Adds PortalDropdownMenu, removes root overflow clipping, and updates themed severity-level and icon styling.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Console
  participant DevToolsFilterDropdown
  participant useClickOutside
  participant PortalDropdownMenu
  Console->>DevToolsFilterDropdown: render console or network filter controls
  DevToolsFilterDropdown->>useClickOutside: register trigger and menu refs
  DevToolsFilterDropdown->>PortalDropdownMenu: render menu in document.body
  useClickOutside->>DevToolsFilterDropdown: close on outside mousedown
Loading

Possibly related PRs

  • usebruno/bruno#6603: Directly overlaps the Console network filter dropdown and related styling.

Suggested reviewers: helloanoop, lohit-bruno, bijin-bruno, naman-bruno, utkarsh-bruno

Poem

Filters bloom in portals bright,
Counts arrange in tidy rows.
Outside clicks dismiss the night,
Log icons wear their themed clothes,
One shared menu keeps things right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing the console and network filter dropdown behavior/scrolling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

@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

🧹 Nitpick comments (3)
packages/bruno-app/src/components/Devtools/Console/StyledWrapper.js (1)

237-306: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove now-dead .filter-dropdown-header/.filter-toggle-all/.filter-dropdown-options/.filter-option* rules.

These selectors were previously used by the in-StyledWrapper dropdown menu. Now that the menu renders via PortalDropdownMenu (which redefines the same selectors at lines 521-591) outside StyledWrapper's DOM subtree, nothing inside StyledWrapper uses these classNames anymore — only the trigger-related rules (.filter-dropdown, .filter-dropdown-trigger, lines 209-235) are still needed here.

🧹 Suggested cleanup
-  .filter-dropdown-header {
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-    padding: 4px 12px;
-    background: ${(props) => props.theme.console.dropdownHeaderBg};
-    border-bottom: 1px solid ${(props) => props.theme.console.border};
-    font-size: ${(props) => props.theme.font.size.sm};
-    font-weight: 500;
-    color: ${(props) => props.theme.console.titleColor};
-  }
-
-  .filter-toggle-all {
-    background: transparent;
-    border: none;
-    color: ${(props) => props.theme.console.buttonColor};
-    cursor: pointer;
-    font-size: ${(props) => props.theme.font.size.xs};
-    font-weight: 500;
-    padding: 2px 4px;
-    border-radius: 2px;
-    transition: all 0.2s ease;
-
-    &:hover {
-      background: ${(props) => props.theme.console.buttonHoverBg};
-    }
-  }
-
-  .filter-dropdown-options {
-    padding: 4px 0;
-  }
-
-  .filter-option {
-    display: flex;
-    align-items: center;
-    padding: 4px 12px;
-    cursor: pointer;
-    transition: background-color 0.2s ease;
-
-    &:hover {
-      background: ${(props) => props.theme.console.optionHoverBg};
-    }
-
-    input[type="checkbox"] {
-      margin: 0 8px 0 0;
-      width: 14px;
-      height: 14px;
-      accent-color: ${(props) => props.theme.console.checkboxColor};
-    }
-  }
-
-  .filter-option-content {
-    display: flex;
-    align-items: center;
-    gap: 8px;
-    flex: 1;
-  }
-
-  .filter-option-label {
-    color: ${(props) => props.theme.console.optionLabelColor};
-    font-size: ${(props) => props.theme.font.size.sm};
-    font-weight: 400;
-  }
-
-  .filter-option-count {
-    color: ${(props) => props.theme.console.optionCountColor};
-    font-size: ${(props) => props.theme.font.size.xs};
-    font-weight: 400;
-    margin-left: auto;
-  }
🤖 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/components/Devtools/Console/StyledWrapper.js` around
lines 237 - 306, Remove the unused `.filter-dropdown-header`,
`.filter-toggle-all`, `.filter-dropdown-options`, `.filter-option`,
`.filter-option-content`, `.filter-option-label`, and `.filter-option-count`
rules from `StyledWrapper`; retain the trigger-related `.filter-dropdown` and
`.filter-dropdown-trigger` styles.
packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.js (2)

5-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Circular import between Console/index.js and Console/FilterDropdown/index.js. FilterDropdown/index.js imports LogIcon back from ../index, while Console/index.js imports FilterDropdown/NetworkFilterDropdown from ./FilterDropdown, forming a two-module cycle. It's currently safe (the named import is only dereferenced inside a render closure, not at module-eval time), but it's a module-boundary smell that can bite with different bundler/test-transform setups.

  • packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.js#L5-L5: stop importing LogIcon from ../index; move LogIcon to its own module (e.g. Console/LogIcon.js) and import it from there instead.
  • packages/bruno-app/src/components/Devtools/Console/index.js#L28-L28: after extracting LogIcon, re-import it from the new shared module here too, breaking the cycle in both directions.
🤖 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/components/Devtools/Console/FilterDropdown/index.js`
at line 5, Extract LogIcon from Console/index.js into a dedicated shared module,
then update
packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.js:5-5
and packages/bruno-app/src/components/Devtools/Console/index.js:28-28 to import
it from that module, removing the circular dependency while preserving existing
usage.

71-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add ARIA state to the dropdown triggers.

Neither trigger exposes aria-haspopup/aria-expanded, so screen readers can't tell this is an expandable menu or its current state.

♿ Suggested attributes
-      <button className="filter-dropdown-trigger" onClick={handleToggle} title="Filter logs by type">
+      <button className="filter-dropdown-trigger" onClick={handleToggle} title="Filter logs by type" aria-haspopup="menu" aria-expanded={isOpen}>

Also applies to: 140-146

🤖 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/components/Devtools/Console/FilterDropdown/index.js`
around lines 71 - 77, Add ARIA state to both dropdown trigger buttons, including
the trigger containing handleToggle and the corresponding trigger around the
referenced second range. Set aria-haspopup to indicate a menu and bind
aria-expanded to the dropdown’s open/closed state so it updates accurately.
🤖 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/components/Devtools/Console/FilterDropdown/index.js`:
- Around line 8-18: Update computeMenuStyle so the calculated maxHeight has a
sane positive minimum when the trigger is near the viewport bottom, preventing
the options list from being hidden; preserve the existing positioning and sizing
behavior when sufficient space remains.

---

Nitpick comments:
In `@packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.js`:
- Line 5: Extract LogIcon from Console/index.js into a dedicated shared module,
then update
packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.js:5-5
and packages/bruno-app/src/components/Devtools/Console/index.js:28-28 to import
it from that module, removing the circular dependency while preserving existing
usage.
- Around line 71-77: Add ARIA state to both dropdown trigger buttons, including
the trigger containing handleToggle and the corresponding trigger around the
referenced second range. Set aria-haspopup to indicate a menu and bind
aria-expanded to the dropdown’s open/closed state so it updates accurately.

In `@packages/bruno-app/src/components/Devtools/Console/StyledWrapper.js`:
- Around line 237-306: Remove the unused `.filter-dropdown-header`,
`.filter-toggle-all`, `.filter-dropdown-options`, `.filter-option`,
`.filter-option-content`, `.filter-option-label`, and `.filter-option-count`
rules from `StyledWrapper`; retain the trigger-related `.filter-dropdown` and
`.filter-dropdown-trigger` styles.
🪄 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: e2fae84d-b02c-49c9-8da5-8596151b355f

📥 Commits

Reviewing files that changed from the base of the PR and between e46f87f and dcf8850.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.js
  • packages/bruno-app/src/components/Devtools/Console/StyledWrapper.js
  • packages/bruno-app/src/components/Devtools/Console/index.js
  • packages/bruno-app/src/hooks/useClickOutside.js

Comment on lines +8 to +18
const computeMenuStyle = (el, setMenuStyle) => {
if (!el) return;
const rect = el.getBoundingClientRect();
setMenuStyle({
position: 'fixed',
top: rect.bottom + 4,
right: window.innerWidth - rect.right,
zIndex: 9999,
maxHeight: window.innerHeight - rect.bottom - 8
});
};

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Clamp/flip menu height near viewport bottom.

maxHeight has no floor: when the trigger sits close to window.innerHeight, window.innerHeight - rect.bottom - 8 can be tiny or negative, effectively hiding the option list — the same visual bug this PR is fixing, just reintroduced via inline sizing instead of overflow: hidden. This is directly relevant since the PR objective explicitly calls out clipping "when the console panel was small or near the viewport bottom."

🛠️ Minimal fix: clamp to a sane floor (consider flipping above the trigger for a full fix)
 const computeMenuStyle = (el, setMenuStyle) => {
   if (!el) return;
   const rect = el.getBoundingClientRect();
+  const spaceBelow = window.innerHeight - rect.bottom - 8;
   setMenuStyle({
     position: 'fixed',
     top: rect.bottom + 4,
     right: window.innerWidth - rect.right,
     zIndex: 9999,
-    maxHeight: window.innerHeight - rect.bottom - 8
+    maxHeight: Math.max(spaceBelow, 120)
   });
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const computeMenuStyle = (el, setMenuStyle) => {
if (!el) return;
const rect = el.getBoundingClientRect();
setMenuStyle({
position: 'fixed',
top: rect.bottom + 4,
right: window.innerWidth - rect.right,
zIndex: 9999,
maxHeight: window.innerHeight - rect.bottom - 8
});
};
const computeMenuStyle = (el, setMenuStyle) => {
if (!el) return;
const rect = el.getBoundingClientRect();
const spaceBelow = window.innerHeight - rect.bottom - 8;
setMenuStyle({
position: 'fixed',
top: rect.bottom + 4,
right: window.innerWidth - rect.right,
zIndex: 9999,
maxHeight: Math.max(spaceBelow, 120)
});
};
🤖 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/components/Devtools/Console/FilterDropdown/index.js`
around lines 8 - 18, Update computeMenuStyle so the calculated maxHeight has a
sane positive minimum when the trigger is near the viewport bottom, preventing
the options list from being hidden; preserve the existing positioning and sizing
behavior when sufficient space remains.

useEffect(() => {
const handleClickOutside = (event) => {
const isOutside = refs.every((ref) => !ref.current || !ref.current.contains(event.target));
if (isOutside) savedOnClose.current();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

check if savedOnClose.current is a function and can be called. This will throw if anyone passes anything other than a callback function.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added the check here.


document.addEventListener('mousedown', handleClickOutside);
return () => document.removeEventListener('mousedown', handleClickOutside);
}, []);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't useEffect be dependent on refs ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes, I have updated the dependencies.

max-width: 250px;
background: ${(props) => props.theme.console.dropdownBg};
border: 1px solid ${(props) => props.theme.console.border};
border-radius: 6px;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess we have a token for border radius in our themes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

used the border radius token.


.log-icon {
flex-shrink: 0;
&.error { color: #f14c4c; }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we use tokens from our theme object? This will look odd if the user is on monochrome theme.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

used the tokens here

const dropdownRef = useRef(null);
const menuRef = useRef(null);

const allFiltersEnabled = Object.values(filters).every((f) => f);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Doesn't this run on every re-render? Should we have it within a useMemo?
Same with activeFilters

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

useMemo not needed here as filter object is very small and .every() and .filter() on a small filters object are negligible cost.

const menuRef = useRef(null);

const allFiltersEnabled = Object.values(filters).every((f) => f);
const activeFilters = Object.entries(filters).filter(([_, enabled]) => enabled);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

useMemo not needed here as filter object is very small and .every() and .filter() on a small filters object are negligible cost.

@chirag-bruno chirag-bruno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it possible to have a common component for both the filters than having 2 implementations? Apart from the icon in the dropdown, everything seems same. Can we have a dropdown which takes in filter ({label: string, value: string, enabled: boolean, icon?:React.Element, count: number}[]) and reuse it in both places? Am I missing something?

@sachin-thakur-bruno

Copy link
Copy Markdown
Collaborator Author

Is it possible to have a common component for both the filters than having 2 implementations? Apart from the icon in the dropdown, everything seems same. Can we have a dropdown which takes in filter ({label: string, value: string, enabled: boolean, icon?:React.Element, count: number}[]) and reuse it in both places? Am I missing something?

Yes, I have created a common DevToolsFilterDropdown and reused it for the filters dropdown.

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.

3 participants