Skip to content

fix: package manager copy buttons#32228

Merged
MohamedH1998 merged 1 commit into
productionfrom
fix/pkgm-copy-buttons
Jul 22, 2026
Merged

fix: package manager copy buttons#32228
MohamedH1998 merged 1 commit into
productionfrom
fix/pkgm-copy-buttons

Conversation

@MohamedH1998

Copy link
Copy Markdown
Contributor

Summary

Clicking a package-manager copy button could make every other copy icon on the page vanish. This fixes it by toggling icons instead of replacing the button's contents.

Why

astro-icon renders the first ph:copy on a page as a shared … and every other instance as . That definition happens to live inside the first copy button.
The click handler swapped the icon with btn.replaceChildren(...). So clicking the button that hosts the definition deleted the , orphaning all 12+ references — every other copy icon disappeared, and didn't come back (the 1.5s "restore" was itself a pointing at the now-missing symbol).
Repro: https://developers.cloudflare.com/workers/framework-guides/automatic-configuration/#deploy-with-automatic-configuration — click one copy button, watch the others go blank.

The fix

  • PackageManagers.astro — each button now renders both icons (ph:copy + a hidden ph:check); dropped the two icon blocks.
  • package-managers.client.ts — the handler toggles the hidden class on the two icons instead of replaceChildren. Nodes are never removed, so the shared always stays in the DOM. Removed the now-unused cloneIcon/template plumbing.
    Doesn't rely on astro-icon's dedup internals: even a display:none is a valid target, and nothing gets detach
  • Screenshots (optional)

    Documentation checklist

    • Is there a changelog entry (guidelines)? If you don't add one for something awesome and new (however small) — how will our customers find out? Changelogs are automatically posted to RSS feeds, the Discord, and X.
    • The change adheres to the documentation style guide.
    • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
    • Files which have changed name or location have been allocated redirects.

@MohamedH1998
MohamedH1998 requested review from a team and kodster28 as code owners July 22, 2026 00:04
@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review

✅ No issues found in commit 028f050.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

No code review issues found.

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. On conflict, attempts to resolve automatically using AI. Stops with an explanation if confidence is not high enough.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
*.astro @cloudflare/content-engineering, @kodster28
*.ts @cloudflare/content-engineering, @kodster28

@github-actions

Copy link
Copy Markdown
Contributor

@MohamedH1998
MohamedH1998 merged commit c50a23e into production Jul 22, 2026
20 checks passed
@MohamedH1998
MohamedH1998 deleted the fix/pkgm-copy-buttons branch July 22, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants