Skip to content

Fixed an issue where Query Tool's Messages tab content right-click "Select All"…#9747

Merged
adityatoshniwal merged 2 commits intopgadmin-org:masterfrom
anilsahoo20:GH-8992
Mar 16, 2026
Merged

Fixed an issue where Query Tool's Messages tab content right-click "Select All"…#9747
adityatoshniwal merged 2 commits intopgadmin-org:masterfrom
anilsahoo20:GH-8992

Conversation

@anilsahoo20
Copy link
Contributor

@anilsahoo20 anilsahoo20 commented Mar 16, 2026

… selects the entire page's content and copying the selection by right-click "Copy" reset the selection. #8992

Summary by CodeRabbit

  • New Features
    • Messages view now uses a read-only, full-width text area for displaying messages.
    • Improved text selection, copy and select-all behavior while preserving existing live message updates.
    • Visual tweaks: borderless/outline-less appearance and disabled resizing for a cleaner, consistent layout.

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Walkthrough

Replaces a styled message-display div with a read-only, controlled textarea in the Messages component; updates styling (width:100%, border/outline removal, disable resize) and renders via value={messageText} while preserving existing state and event-bus message updates.

Changes

Cohort / File(s) Summary
Messages component UI
web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx
Replaced a styled div with a styled textarea. Added width: 100%, removed border/outline, set resize: none; removed userSelect. Component now renders a controlled, readOnly textarea using value={messageText}, keeping existing message update logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change - fixing the right-click 'Select All' behavior in the Query Tool's Messages tab. It directly relates to the primary purpose of converting the div to a textarea to scope selection correctly.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx (1)

62-69: Consider adding error handling for clipboard write.

navigator.clipboard.writeText() returns a Promise that can reject if clipboard access is denied. While pgAdmin typically runs in secure contexts where this should succeed, adding a .catch() would prevent unhandled promise rejections.

🔧 Suggested improvement
   const copyToClipboard = React.useCallback(()=>{
     const selection = window.getSelection();
     const text = selection.toString();
     if(text) {
-      navigator.clipboard.writeText(text);
+      navigator.clipboard.writeText(text).catch(()=>{
+        /* Clipboard access denied or unavailable */
+      });
     }
     setContextPos(null);
   }, []);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx`
around lines 62 - 69, The copyToClipboard callback (copyToClipboard) currently
calls navigator.clipboard.writeText(text) without handling rejections; update it
to handle the returned Promise by adding error handling (either await in an
async wrapper or attach .then/.catch) so clipboard write failures are caught and
logged or handled (e.g., call process/logging handler or silently ignore), and
ensure setContextPos(null) still runs; reference copyToClipboard,
navigator.clipboard.writeText, and setContextPos when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx`:
- Around line 62-69: The copyToClipboard callback (copyToClipboard) currently
calls navigator.clipboard.writeText(text) without handling rejections; update it
to handle the returned Promise by adding error handling (either await in an
async wrapper or attach .then/.catch) so clipboard write failures are caught and
logged or handled (e.g., call process/logging handler or silently ignore), and
ensure setContextPos(null) still runs; reference copyToClipboard,
navigator.clipboard.writeText, and setContextPos when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aebb9f46-02f0-46bd-8d82-c68396dd7962

📥 Commits

Reviewing files that changed from the base of the PR and between c8bd75c and fa08e72.

📒 Files selected for processing (1)
  • web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx

…elect All" selects the entire page's content and copying the selection by right-click "Copy" reset the selection. pgadmin-org#8992
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx (1)

14-28: Styling changes look appropriate for the textarea.

The added styles (width: 100%, border: none, outline: none, resize: none) are suitable for a read-only message display area. However, removing outline: none eliminates the focus indicator for keyboard users.

Consider preserving focus visibility for accessibility:

♿ Optional: Add focus indicator for keyboard navigation
   border: 'none',
-  outline: 'none',
+  outline: 'none',
+  '&:focus': {
+    outline: `1px solid ${theme.palette.primary.main}`,
+  },
   resize: 'none',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx`
around lines 14 - 28, The StyledTextarea currently sets outline: 'none',
removing the keyboard focus indicator and harming accessibility; update the
StyledTextarea styling to preserve a visible focus state for keyboard users by
removing the global outline:none or replacing it with a focus-specific rule
(e.g., add a &:focus or &:focusVisible style on StyledTextarea that applies a
clear visible outline or box-shadow using theme colors such as
theme.palette.primary.main or theme.palette.action.active), so the component
retains no visible border normally but shows a strong focus indicator when
focused via keyboard.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx`:
- Around line 14-28: The StyledTextarea currently sets outline: 'none', removing
the keyboard focus indicator and harming accessibility; update the
StyledTextarea styling to preserve a visible focus state for keyboard users by
removing the global outline:none or replacing it with a focus-specific rule
(e.g., add a &:focus or &:focusVisible style on StyledTextarea that applies a
clear visible outline or box-shadow using theme colors such as
theme.palette.primary.main or theme.palette.action.active), so the component
retains no visible border normally but shows a strong focus indicator when
focused via keyboard.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 961e97c6-cdc7-4632-a48a-eb8ea9013f56

📥 Commits

Reviewing files that changed from the base of the PR and between c0c7e0e and 0415fa9.

📒 Files selected for processing (1)
  • web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx

@adityatoshniwal adityatoshniwal merged commit 01c2d12 into pgadmin-org:master Mar 16, 2026
33 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.

2 participants