Open
Conversation
hjpalpha
approved these changes
Mar 13, 2026
Collaborator
hjpalpha
left a comment
There was a problem hiding this comment.
seems reasonable on phone
Contributor
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.
Comment on lines
+24
to
+30
| createSelectButton() { | ||
| const selectButton = document.createElement( 'button' ); | ||
| selectButton.classList.add( 'btn' ); | ||
| selectButton.classList.add( 'btn-secondary' ); | ||
| selectButton.innerHTML = 'Select'; | ||
| selectButton.addEventListener( 'click', () => this.selectElementText() ); | ||
| return selectButton; |
| } | ||
|
|
||
| this.selectElementText(); | ||
| await navigator.clipboard.writeText( this.element.innerText ); |
| } | ||
|
|
||
| this.selectElementText(); | ||
| await navigator.clipboard.writeText( this.element.innerText ); |
Comment on lines
+23
to
24
| await navigator.clipboard.writeText( rawText ); | ||
| liquipedia.copytoclipboard.showNotification( parent ); |
| liquipedia.copytoclipboard.selectAndCopy(); | ||
| liquipedia.copytoclipboard.removeInputBox(); | ||
| if ( !navigator.clipboard || !navigator.clipboard.writeText ) { | ||
| mw.notify( 'This browser does not support copying text to the clipboard.', { type: 'error' } ); |
Comment on lines
+26
to
+27
| "stylelint-scss": "^7.x.x", | ||
| "types-mediawiki": "^2.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes existing uses of
Document.execCommand()(deprecated)How did you test this change?
browser dev tools