fix(gui): close logs detail dialog on outside click - #1403
Conversation
Match the modal-backdrop-dismiss pattern used by other dialogs so clicking outside the logs Details window dismisses it.
|
✅ READY
UI screenshot waived by the Hygiene✅ Deterministic PR hygiene checks passed. |
|
Warning Review limit reached
Next review available in: 25 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe log detail dialog now supports backdrop dismissal through an accessible button. Clicks inside the dialog card no longer trigger backdrop dismissal. Tests verify the button, its tab index, and dialog removal. ChangesLog dialog interaction
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
Add a focused regression test so the logs Details dialog keeps closing on outside click.
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 `@gui/tests/logs-auto-refresh.test.tsx`:
- Around line 466-475: Update the dialog test around detailBtn and backdrop to
first query and click the .log-detail-card element, then assert the dialog
remains present before clicking .modal-backdrop-dismiss. Preserve the existing
backdrop-click assertion that the dialog closes, ensuring the test covers both
inside-card non-dismissal and backdrop dismissal.
🪄 Autofix
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: ASSERTIVE
Plan: Pro Plus
Run ID: ffdc229b-d264-4869-a958-3db341e72f0a
📒 Files selected for processing (1)
gui/tests/logs-auto-refresh.test.tsx
| const detailBtn = container.querySelector<HTMLButtonElement>(".log-detail-btn")!; | ||
| await act(async () => { detailBtn.click(); }); | ||
| expect(container.querySelector("dialog")).not.toBeNull(); | ||
|
|
||
| const backdrop = container.querySelector<HTMLButtonElement>(".modal-backdrop-dismiss")!; | ||
| expect(backdrop).not.toBeNull(); | ||
| expect(backdrop.tabIndex).toBe(-1); | ||
|
|
||
| await act(async () => { backdrop.click(); }); | ||
| expect(container.querySelector("dialog")).toBeNull(); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Test the inside-card non-dismissal path.
This test clicks the backdrop-dismiss button, but it does not click .log-detail-card. A regression that removes event.stopPropagation() in gui/src/pages/Logs.tsx Lines 858-895 would still pass. Because the PR contract requires clicks inside the dialog to keep it open, click the card and assert that the dialog remains before clicking the backdrop.
Proposed test addition
expect(container.querySelector("dialog")).not.toBeNull();
+ const dialogCard = container.querySelector<HTMLDivElement>(".log-detail-card")!;
+ await act(async () => { dialogCard.click(); });
+ expect(container.querySelector("dialog")).not.toBeNull();
+
const backdrop = container.querySelector<HTMLButtonElement>(".modal-backdrop-dismiss")!;📝 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 detailBtn = container.querySelector<HTMLButtonElement>(".log-detail-btn")!; | |
| await act(async () => { detailBtn.click(); }); | |
| expect(container.querySelector("dialog")).not.toBeNull(); | |
| const backdrop = container.querySelector<HTMLButtonElement>(".modal-backdrop-dismiss")!; | |
| expect(backdrop).not.toBeNull(); | |
| expect(backdrop.tabIndex).toBe(-1); | |
| await act(async () => { backdrop.click(); }); | |
| expect(container.querySelector("dialog")).toBeNull(); | |
| const detailBtn = container.querySelector<HTMLButtonElement>(".log-detail-btn")!; | |
| await act(async () => { detailBtn.click(); }); | |
| expect(container.querySelector("dialog")).not.toBeNull(); | |
| const dialogCard = container.querySelector<HTMLDivElement>(".log-detail-card")!; | |
| await act(async () => { dialogCard.click(); }); | |
| expect(container.querySelector("dialog")).not.toBeNull(); | |
| const backdrop = container.querySelector<HTMLButtonElement>(".modal-backdrop-dismiss")!; | |
| expect(backdrop).not.toBeNull(); | |
| expect(backdrop.tabIndex).toBe(-1); | |
| await act(async () => { backdrop.click(); }); | |
| expect(container.querySelector("dialog")).toBeNull(); |
🤖 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 `@gui/tests/logs-auto-refresh.test.tsx` around lines 466 - 475, Update the
dialog test around detailBtn and backdrop to first query and click the
.log-detail-card element, then assert the dialog remains present before clicking
.modal-backdrop-dismiss. Preserve the existing backdrop-click assertion that the
dialog closes, ensuring the test covers both inside-card non-dismissal and
backdrop dismissal.
Cover stopPropagation on the detail card before the backdrop-dismiss assertion.
Summary
Test plan
Summary by CodeRabbit