Conversation
hjpalpha
left a comment
There was a problem hiding this comment.
seems reasonable on phone
There was a problem hiding this comment.
Pull request overview
This PR modernizes “select all / copy to clipboard” behaviors by removing deprecated Document.execCommand() usage and switching to Selection + navigator.clipboard APIs in the commons JS utilities.
Changes:
- Refactors
Selectallto select text via DOM Ranges and copy vianavigator.clipboard.writeText, along with updated wrapper/button styling. - Updates
CopyToClipboardto usenavigator.clipboard.writeTextand error-notify when unsupported. - Adds
types-mediawikito devDependencies.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| stylesheets/commons/Selectall.scss | Updates layout styles to match the new wrapper/button structure (removes textarea-overlay approach). |
| javascript/commons/Selectall.js | Replaces textarea + execCommand('copy') flow with Range selection and Clipboard API copy. |
| javascript/commons/CopyToClipboard.js | Removes execCommand fallback and relies on Clipboard API with user notification on lack of support. |
| package.json | Adds types-mediawiki dev dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR refactors the existing “select all / copy to clipboard” UI behaviors to remove deprecated Document.execCommand() usage and rely on modern Clipboard APIs in the Liquipedia client-side modules.
Changes:
- Refactored
Selectallto select text viaRange/Selectionand copy vianavigator.clipboard.writeText. - Refactored
CopyToClipboardto use async Clipboard API with user notifications on unsupported/failure paths (and removed the oldexecCommand-based fallback). - Simplified the Selectall SCSS to match the new DOM structure and added
types-mediawikias a devDependency.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| stylesheets/commons/Selectall.scss | Removes styles for the old textarea-overlay approach; keeps layout styles for the new wrapper/buttons. |
| javascript/commons/Selectall.js | Replaces execCommand('copy') flow with Selection + Clipboard API and simplifies wrapper creation. |
| javascript/commons/CopyToClipboard.js | Replaces execCommand('copy') fallback with async Clipboard API + error notifications. |
| package.json | Adds types-mediawiki devDependency (intended for editor/type support). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
This PR removes existing uses of
Document.execCommand()(deprecated)How did you test this change?
browser dev tools