Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,27 @@ import DraftTabIcon from '../DraftTabIcon';
import StyledWrapper from './StyledWrapper';

const GradientCloseButton = ({ onClick, hasChanges = false }) => {
// Prevent the browser's autoscroll (triggered on middle-button mousedown)
const handleMouseDown = (e) => {
if (e.button === 1) {
e.preventDefault();
}
};

const handleMouseUp = (e) => {
if (e.button === 1) {
e.preventDefault();
e.stopPropagation();
onClick?.(e);
}
};

return (
<StyledWrapper className={`close-gradient ${hasChanges ? 'has-changes' : ''}`}>
<StyledWrapper
className={`close-gradient ${hasChanges ? 'has-changes' : ''}`}
onMouseDown={handleMouseDown}
onMouseUp={handleMouseUp}
>
Comment on lines +23 to +27

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a regression test for middle-click over the close overlay.

This is a user-visible behavior fix, so it needs coverage proving middle-click still closes when the pointer is over the overlay area near the close affordance. As per coding guidelines, "Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created."

🤖 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/RequestTabs/RequestTab/GradientCloseButton/index.js`
around lines 23 - 27, The GradientCloseButton overlay behavior needs regression
coverage for middle-click on the close affordance area. Add a test around the
GradientCloseButton component that exercises the close overlay via middle mouse
button while the pointer is over the overlay and verifies the tab still closes;
reference the StyledWrapper handlers and handleMouseDown/handleMouseUp path so
the test stays aligned if the implementation moves.

Source: Coding guidelines

<div className="close-icon-container" onClick={onClick} data-testid="request-tab-close-icon">
<span className="draft-icon-wrapper" data-testid="tab-draft-icon">
<DraftTabIcon />
Expand Down