Skip to content

Fix duplicate docs copy handlers and error-dialog cleanup - #78610

Merged
pelikhan merged 5 commits into
mainfrom
copilot/fix-copy-file-button-bugs
Nov 17, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/fix-copy-file-button-bugs

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Repeated inline scripts attach duplicate copy handlers. Script-created error dialogs also miss scoped styles and leak Escape listeners when dismissed by × or outside click.

  • Copy handlers: Guard initialization with data-copy-handler-attached.
  • Dialog styling: Make .error-modal* selectors global.
  • Listener cleanup: Remove the Escape listener in the shared close function.
  • Regression coverage: Check one fetch per click, computed modal styles, and listener counts across repeated opens and all three close paths.

@pelikhan pelikhan changed the title [WIP] Fix duplicate click handlers and style errors in copy-file buttons Fix duplicate docs copy handlers and error-dialog cleanup Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Visual regression check

Overview: Captured the built docs home page at three viewports from a sandbox-local preview. No authorized baseline is provisioned, so visual comparison is unavailable for every viewport. This is not a clean result.

Results

Page Viewport Capture Comparison
/gh-aw/ Mobile 375x812 captured unavailable
/gh-aw/ Tablet 768x1024 captured unavailable
/gh-aw/ Desktop 1440x900 captured unavailable

Accessibility (structural check)

Scope: home page snapshot at desktop viewport only. This is not an exhaustive compliance audit.

  • No accessibility concerns confirmed in this pass.
  • Four links flagged as unnamed by text search were false positives: each has visible text in a child element.
  • Console: 0 errors, 4 WebGL GPU-stall driver warnings (not application errors).
Not verified and cleanup status
  • Pixel comparison: not performed (no baseline).
  • Mobile and tablet accessibility snapshots: not taken.
  • Browser closed. Preview server stopped; loopback now refuses connections and the server no longer appears in the shell list.
  • The Playwright session wrote a .playwright-cli/ directory into the workspace. I could not verify or remove it because a workspace check was denied by tool permissions.

References: §44020754500

Generated by 👁️ Visual Regression Checker for #78610 · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~1 AIC · ⊞ 3.3K · ◷

@pelikhan
pelikhan marked this pull request as ready for review November 17, 2026 05:09
Copilot AI adaptive review requested due to automatic review settings November 17, 2026 05:09
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the copy-button and error-dialog changes.

No open issues 🎉

What changed in this PR

Fixes copy-button and error-dialog behavior in the docs site, addressing #78586.

Changes:

  • Prevents repeated inline scripts from attaching duplicate copy handlers.
  • Makes styles apply to script-created dialogs and removes the Escape listener on every close path.
  • Adds regression tests for one fetch per click, computed dialog styles, and listener cleanup across repeated opens.
File Description
docs/​tests/​copy-button-regressions.spec.ts Adds coverage for duplicate requests, dialog styling, and all three dismissal paths.
docs/​src/​components/​CopyEntireFileButton.astro Guards handler initialization, globalizes modal styles, and centralizes listener cleanup.

Review effort: Balanced (adaptive)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the component fixes and the new regression spec.

Production change looks correct:

  • data-copy-handler-attached guard prevents duplicate click handlers when the component is used more than once on a page.
  • :global(...) on .error-modal* selectors fixes styling for the script-created dialog, which Astro scoping otherwise misses.
  • closeModal now removes the Escape listener on all three close paths (close button, outside click, Escape).

Non-blocking: one unexplained Enter keypress in the listener-cleanup loop (inline comment on docs/tests/copy-button-regressions.spec.ts:77). Removing it or asserting the intended behavior would make the test clearer.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~1 AIC · ⊞ 4.3K

const overlay = page.locator(".error-modal-overlay");
await expect(overlay).toHaveCount(1);
await expect.poll(listenerCount).toBe(baseline + 1);
await page.keyboard.press("Enter");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This Enter press has no clear purpose and makes the loop harder to trust. The copy button is disabled for 3 seconds after an error, so the key press is most likely a no-op here. If the timing ever changes, Enter could start a second copy flow and open another dialog, which would break the toHaveCount(0) and toHaveCount(1) assertions in the next iteration.

Remove the line. If the goal is to verify keyboard activation of the trigger, assert that behavior explicitly instead.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removed the redundant Enter press. The change is in 1903a6c.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (docs/tests/copy-button-regressions.spec.ts:77): address unresolved feedback - Review comment
  3. Fix failing check conclusion (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "791e1009f0b05438e8888440ba0d384610967934",
  "kind": "requested",
  "schema_version": "1",
  "state": "c18de89456d07ddd9177cd1567460b8c2bcbad4f0334032a14daf8d0b8c3fe4a",
  "work": [
    "51e2287c3d1ee41b7e13769862add61dcd292a623cf943abc5968c984e246bcf",
    "7e146e5a6f2200d09e81f508c0fefab75557e7037dac5b057b70abe0c4f38286"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 2 commits November 17, 2026 05:48

Copilot AI commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged latest main with make merge-main (merge commit 9828607) and addressed the regression-test feedback in 1903a6c. The failed conclusion logs show a tool call explicitly rejected during that run; I found no related source-code failure to fix and did not trigger a retry. The targeted Playwright test could not run because the locked dependencies were absent and DNS resolution failed for both configured npm registry hosts.

Copilot AI requested a review from gh-aw-bot November 17, 2026 06:06
@pelikhan
pelikhan merged commit 4995ca9 into main Nov 17, 2026
25 checks passed
@pelikhan
pelikhan deleted the copilot/fix-copy-file-button-bugs branch November 17, 2026 06:10
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.1

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: copy-file buttons bind duplicate click handlers; error dialog is unstyled and leaks its Escape listener

4 participants