Repository navigation
fix(dev-tools): console and network filter dropdown scroll - #8613
sachin-thakur-bruno wants to merge 5 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe 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. ChangesConsole filter dropdowns
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
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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
🧹 Nitpick comments (3)
packages/bruno-app/src/components/Devtools/Console/StyledWrapper.js (1)
237-306: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove now-dead
.filter-dropdown-header/.filter-toggle-all/.filter-dropdown-options/.filter-option*rules.These selectors were previously used by the in-
StyledWrapperdropdown menu. Now that the menu renders viaPortalDropdownMenu(which redefines the same selectors at lines 521-591) outsideStyledWrapper's DOM subtree, nothing insideStyledWrapperuses 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 winCircular import between
Console/index.jsandConsole/FilterDropdown/index.js.FilterDropdown/index.jsimportsLogIconback from../index, whileConsole/index.jsimportsFilterDropdown/NetworkFilterDropdownfrom./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 importingLogIconfrom../index; moveLogIconto 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 extractingLogIcon, 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 winAdd 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
📒 Files selected for processing (4)
packages/bruno-app/src/components/Devtools/Console/FilterDropdown/index.jspackages/bruno-app/src/components/Devtools/Console/StyledWrapper.jspackages/bruno-app/src/components/Devtools/Console/index.jspackages/bruno-app/src/hooks/useClickOutside.js
| 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 | ||
| }); | ||
| }; |
There was a problem hiding this comment.
🎯 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.
| 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(); |
There was a problem hiding this comment.
check if savedOnClose.current is a function and can be called. This will throw if anyone passes anything other than a callback function.
There was a problem hiding this comment.
added the check here.
|
|
||
| document.addEventListener('mousedown', handleClickOutside); | ||
| return () => document.removeEventListener('mousedown', handleClickOutside); | ||
| }, []); |
There was a problem hiding this comment.
shouldn't useEffect be dependent on refs ?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
I guess we have a token for border radius in our themes.
There was a problem hiding this comment.
used the border radius token.
|
|
||
| .log-icon { | ||
| flex-shrink: 0; | ||
| &.error { color: #f14c4c; } |
There was a problem hiding this comment.
Can we use tokens from our theme object? This will look odd if the user is on monochrome theme.
There was a problem hiding this comment.
used the tokens here
| const dropdownRef = useRef(null); | ||
| const menuRef = useRef(null); | ||
|
|
||
| const allFiltersEnabled = Object.values(filters).every((f) => f); |
There was a problem hiding this comment.
Doesn't this run on every re-render? Should we have it within a useMemo?
Same with activeFilters
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
useMemo not needed here as filter object is very small and .every() and .filter() on a small filters object are negligible cost.
chirag-bruno
left a comment
There was a problem hiding this comment.
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 |
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
FilterDropdownandNetworkFilterDropdowninto their own file. Also contains:LogIcon— local icon component for log type indicatorscomputeMenuStyle— shared helper that computestop,right,maxHeightfrom the trigger's bounding rectConsole/StyledWrapper.jsAdded
PortalDropdownMenuas a named export — a standalone styled component with all dropdown styles. Required because the portal renders outsideStyledWrapper, so nested CSS selectors no longer apply.Console/index.jsFilterDropdownandNetworkFilterDropdowndefinitions./FilterDropdownIconFilter,IconChevronDown)Screen.Recording.2026-06-12.at.4.40.10.PM.mov
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