Skip to content

refactor: remove uses of execCommand()#7246

Open
ElectricalBoy wants to merge 8 commits intomainfrom
js-impl-updates
Open

refactor: remove uses of execCommand()#7246
ElectricalBoy wants to merge 8 commits intomainfrom
js-impl-updates

Conversation

@ElectricalBoy
Copy link
Collaborator

Summary

This PR removes existing uses of Document.execCommand() (deprecated)

How did you test this change?

browser dev tools

@ElectricalBoy ElectricalBoy requested review from a team as code owners March 13, 2026 08:16
@ElectricalBoy ElectricalBoy added the javascript Changes to JavaScript files label Mar 13, 2026
Copy link
Collaborator

@hjpalpha hjpalpha left a comment

Choose a reason for hiding this comment

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

seems reasonable on phone

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Selectall to select text via DOM Ranges and copy via navigator.clipboard.writeText, along with updated wrapper/button styling.
  • Updates CopyToClipboard to use navigator.clipboard.writeText and error-notify when unsupported.
  • Adds types-mediawiki to 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Selectall to select text via Range/Selection and copy via navigator.clipboard.writeText.
  • Refactored CopyToClipboard to use async Clipboard API with user notifications on unsupported/failure paths (and removed the old execCommand-based fallback).
  • Simplified the Selectall SCSS to match the new DOM structure and added types-mediawiki as 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Changes to JavaScript files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants