-
Notifications
You must be signed in to change notification settings - Fork 120
fix: Remove console error and improve copy-code utility cross-browser⦠#496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
β¦ compatibility - Replace console.error with user-friendly visual feedback - Add secure context check for modern clipboard API - Enhance fallback method for older browsers and HTTP contexts - Add mobile device support with setSelectionRange - Implement visual success/error states on copy buttons - Improve error handling with graceful degradation Fixes console noise when copy operation fails and ensures copy functionality works across all browsers including Firefox, Safari, and older browser versions.
β Checks Failed
Please fix the following issues before merging: π Code Linting FailedIssue: Code formatting or style violations detected. Specific problems: β’ TypeScript linting failed How to fix:
Need help with linting? Check out the Linting Guide for Windows Users for detailed instructions. π οΈ Next Steps
|
- Remove unused 'error' parameters from catch blocks to fix linting - Apply code formatting with prettier - Ensure TypeScript linting compliance
β Checks Failed
Please fix the following issues before merging: π Code Linting FailedIssue: Code formatting or style violations detected. Specific problems: β’ Markdown linting failed How to fix:
Need help with linting? Check out the Linting Guide for Windows Users for detailed instructions. π οΈ Next Steps
|
π All Checks Passed!
β Completed Workflows
π This PR is ready for review and can be safely merged to Great work! Your code meets all quality standards. π |
|
@sa-fw-an hi can you kindly review the pr and merge it |
π All Checks Passed!
β Completed Workflows
π This PR is ready for review and can be safely merged to Great work! Your code meets all quality standards. π |
|
hi maintainers @sa-fw-an @FirePheonix !! kindly review the pr and merge it |
Pull Request: Fix Copy-Code Console Error
π Description
This PR fixes the console error in the copy-code utility that was generating unnecessary noise when no code content was found to copy. The changes improve cross-browser compatibility and provide user-friendly visual feedback instead of developer-focused console errors.
Key Improvements:
Fixes console noise when copy operation fails and ensures copy functionality works across all browsers including Firefox, Safari, and older browser versions.
π Related Issue
Fixes #493 - Copy-Code Error Handling
π Type of Change
π· Visual Changes
Before: Console error appears when copy fails
After: Visual button feedback (green "Copied!" or red "Failed") with no console errors
π§ͺ Testing Performed
π± Browser Compatibility
π₯οΈ Responsive Design
β Test Cases
βΏ Accessibility
π PR Checklist
π Additional Notes
This fix addresses the user experience issue where developers would see console errors during normal website usage. The new implementation:
The changes are minimal and focused, ensuring no breaking changes to existing functionality while significantly improving the user experience across all browsers and devices.
π§ Technical Details
Before (Issues):
After (Fixed):
Cross-Browser Compatibility:
navigator.clipboard.writeText()document.execCommand('copy')setSelectionRange()for better text selectionπ Reviewer Resources
Thank you for contributing to the Sugar Labs website! π