Repository navigation
Fix duplicate docs copy handlers and error-dialog cleanup - #78610
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Visual regression checkOverview: 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
Accessibility (structural check)Scope: home page snapshot at desktop viewport only. This is not an exhaustive compliance audit.
Not verified and cleanup status
References: §44020754500
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: 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.
|
There was a problem hiding this comment.
🟢 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)
There was a problem hiding this comment.
Reviewed the component fixes and the new regression spec.
Production change looks correct:
data-copy-handler-attachedguard 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.closeModalnow 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"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Removed the redundant Enter press. The change is in 1903a6c.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
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"
}
|
…-button-bugs Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged latest |
|
🎉 This pull request is included in a new release. Release: |
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.
data-copy-handler-attached..error-modal*selectors global.