Fixed an issue where Query Tool's Messages tab content right-click "Select All"…#9747
Conversation
WalkthroughReplaces a styled message-display Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 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
📒 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
There was a problem hiding this comment.
🧹 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, removingoutline: noneeliminates 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
📒 Files selected for processing (1)
web/pgadmin/tools/sqleditor/static/js/components/sections/Messages.jsx
… selects the entire page's content and copying the selection by right-click "Copy" reset the selection. #8992
Summary by CodeRabbit