Skip to content

Hide the copy button whilst the find or go to line dialog covers it in read-only SQL editors. #10910 - #10911

Merged
dpage merged 1 commit into
pgadmin-org:masterfrom
dpage:fix/issue-10910-copy-button-dialogs
Nov 30, 2026
Merged

dpage merged 1 commit into
pgadmin-org:masterfrom
dpage:fix/issue-10910-copy-button-dialogs

Conversation

@dpage

@dpage dpage commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The find and go to line dialogs sit over the copy button in the top right corner, so a click meant for it toggled 'Use regex' or closed the dialog and nothing was copied.
  • The shared CodeMirror component now hides its copy button (SQL tab, Schema Diff, About) whilst either dialog is open, and reports the dialogs opening and closing through a new onDialogToggle prop. The Query Tool's Data Output SQL popup, whose Copy SQL button lives outside the editor, uses that prop to hide its button too. The button comes back as soon as the dialog closes.
  • I hid the button rather than move either element, since raising its z-index would just cover the regex toggle, and the popup's focus trap, Escape handling, click-away and minimum width from Make the Data Output SQL popup in the Query Tool keyboard accessible. #10866 #10879 and Keep the find and go to line dialogs inside the Data Output SQL popup in the Query Tool. #10904 #10905 are unchanged.

Test plan

  • Jest: new cases in CodeMirror.spec.js (button hidden whilst find or go to line is open, onDialogToggle called, button back after Close) and ResultSetCopyQuery.spec.js (Copy SQL hidden and skipped by Tab whilst a dialog is open, back afterwards); both fail without the fix. jest --findRelatedTests on the two changed components: 153 suites, 1101 tests pass.
  • eslint on the changed files.
  • Playwright on a production bundle against PostgreSQL 18, in the SQL tab and the Data Output SQL popup, at 1400x900 and 800x500: with no dialog the button is visible, on top and copies; with find or go to line open it is no longer rendered; after Escape it is back, on top and copies.

Closes #10910

Summary by CodeRabbit

  • Bug Fixes
    • The Copy button is hidden while the find or go-to-line dialog is open and returns when the dialog closes.
    • In the SQL query popup, the Copy SQL button is removed from the tab order while an editor dialog is open and restored when it closes.

…n read-only SQL editors. pgadmin-org#10910

The find and go to line dialogs sit in the same top right corner as the
copy button, and drawn on top of it, so a click meant for the button
toggled 'Use regex' or closed the dialog instead. The shared CodeMirror
component now hides its own copy button (SQL tab, Schema Diff, About)
whilst either dialog is open, and tells its parent through a new
onDialogToggle prop, which the Query Tool's Data Output SQL popup uses to
hide its Copy SQL button in the same way. The button comes back when the
dialog closes.

Closes pgadmin-org#10910
@dpage dpage self-assigned this Nov 30, 2026
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

CodeMirror now reports whether its find or go-to-line dialog is open and hides its copy button while either dialog is open. The SQL query popup uses that state to hide its Copy SQL button. Tests cover dialog transitions and popup keyboard navigation.

Changes

Editor Copy Button Visibility

Layer / File(s) Summary
Shared editor dialog state
web/pgadmin/static/js/components/ReactCodeMirror/index.jsx, web/regression/javascript/components/CodeMirror.spec.js
CodeMirror adds the optional onDialogToggle callback and hides its copy button while a find or go-to-line dialog is open. Tests cover opening and closing both dialogs and copy button visibility.
SQL popup copy button
web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSetToolbar.jsx, web/regression/javascript/sqleditor/ResultSetCopyQuery.spec.js
The SQL popup tracks CodeMirror dialog state and hides its Copy SQL button while a dialog is open. Tests cover button visibility and Tab navigation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • pgadmin-org/pgadmin4#10879: Adds focus trapping and click-away handling to the Data Output SQL popup. This PR builds on that popup behavior.

Suggested reviewers: adityatoshniwal, rohitbhati8269

Merge Risk: Minimal · up to f3297

This change hides the copy buttons in read-only SQL editors while the Find or Go to Line dialog is open, and restores them when the dialog closes. It is localized and reversible, and I found no concrete merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: the copy button is hidden while the find or go-to-line dialog overlaps it in read-only SQL editors. The raw summary shows CodeMirror hides the copy button while eithe…
Linked Issues check Passed [#10910] The issue asks that Find (Ctrl+F) and Go to Line dialogs not cover the copy button in read-only CodeMirror editors. The issue names hiding the button while a dialog is open as an acceptable f…
Out of Scope Changes check Passed The changes in the reviewed diff are limited to the issue scope. ReactCodeMirror/index.jsx adds the onDialogToggle prop, the dialogOpen flag, the copy-button gate, and the propTypes entry. ResultS…
Full details: Title check

Explanation

The title states the main change: the copy button is hidden while the find or go-to-line dialog overlaps it in read-only SQL editors. The raw summary shows CodeMirror hides the copy button while either dialog is open, and the ResultSetToolbar popup follows the same behavior through onDialogToggle. The title includes the issue reference #10910, which is acceptable. It does not mention the onDialogToggle prop, but that is a secondary detail.

Full details: Linked Issues check

Explanation

[#10910] The issue asks that Find (Ctrl+F) and Go to Line dialogs not cover the copy button in read-only CodeMirror editors. The issue names hiding the button while a dialog is open as an acceptable fix, and rules out raising the z-index. In web/pgadmin/static/js/components/ReactCodeMirror/index.jsx at the reviewed head, dialogOpen = showFind || showGoto gates the CopyButton render (showCopy && !dialogOpen). This covers the SQL tab, Schema Diff, and About, which all use the shared component. The component also calls the new onDialogToggle prop with the dialog state. In web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSetToolbar.jsx at the reviewed head, ShowDataOutputQueryPopup keeps editorDialogOpen state, wires it through onDialogToggle={setEditorDialogOpen}, and omits the .DataOutputQuery-copyButton while it is true. This covers the Data Output SQL popup. The button returns when the dialog closes, because the state and the render both depend on the dialog state. Automated tests are described in CodeMirror.spec.js and ResultSetCopyQuery.spec.js (hidden while open, callback called, restored after Close, skipped by Tab). The test files were not read directly. The ResultSetToolbar diff could not be read as a text diff, so the change was confirmed from the reviewed head file and the change summary.

Full details: Out of Scope Changes check

Explanation

The changes in the reviewed diff are limited to the issue scope. ReactCodeMirror/index.jsx adds the onDialogToggle prop, the dialogOpen flag, the copy-button gate, and the propTypes entry. ResultSetToolbar.jsx adds the popup dialog-state tracking and the conditional copy-button render (+5/-2 lines per the change summary). The test files cover the same behaviour. The popup behaviour cited in the PR description (focus trap, Escape handling, click-away, minimum width, keepInWindow, getVisibleTabbable) is present at the reviewed head. The change summary does not list these as added lines, so they appear to come from earlier work (#10879, #10905) and are not changed here. The ResultSetToolbar text diff could not be read, so this conclusion relies on the head file and the change summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between de67205 and f32975c.

Files selected for processing: 4

  • web/pgadmin/static/js/components/ReactCodeMirror/index.jsx
  • web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSetToolbar.jsx
  • web/regression/javascript/components/CodeMirror.spec.js
  • web/regression/javascript/sqleditor/ResultSetCopyQuery.spec.js

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@dpage
dpage merged commit 36487e7 into pgadmin-org:master Nov 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Find and Go to Line boxes cover the copy button in read-only SQL editors

1 participant