Fix PHP snippet Run button pointer activation - #3639
Merged
Conversation
adamziel
marked this pull request as ready for review
May 14, 2026 15:36
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes PHP snippet Run button by triggering execution on pointerdown rather than relying on the final click event, while preventing duplicate runs from the synthetic click that follows.
Changes:
- Run the snippet on
pointerdown(primary button) and track activation via_pointerActivatedRun. - Suppress the subsequent real (non-synthetic)
clickso a single mouse press still results in one run; keepclickpath for keyboard/programmatic activation. - Add Playwright tests covering canceled pointer clicks and repeated real mouse clicks.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/playground/website/public/php-code-snippet.js | Adds pointerdown/pointerup/pointercancel handlers, gates the click handler with a flag to avoid double-running. |
| packages/playground/website/playwright/e2e/php-code-snippet.spec.ts | Adds two tests verifying pointer activation and repeated mouse-click behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+745
to
+749
| this.shadowRoot.addEventListener('pointerup', () => { | ||
| setTimeout(() => { | ||
| this._pointerActivatedRun = false; | ||
| }, 0); | ||
| }); |
Comment on lines
+735
to
+744
| this.shadowRoot.addEventListener('pointerdown', (event) => { | ||
| const target = event.target; | ||
| const runButton = | ||
| target instanceof Element ? target.closest('.run') : null; | ||
| if (!runButton || event.button !== 0) { | ||
| return; | ||
| } | ||
| this._pointerActivatedRun = true; | ||
| this._run(); | ||
| }); |
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.
What changed
pointerdowninstead of waiting only for the final browserclickevent.Why
Cmd/Ctrl+Enter was reliable because it calls
_run()directly. Pointer activation could still disappear if the browser did not dispatch the finalclickevent after a press/release sequence, making the Run button look like every other click was ignored. Starting frompointerdownremoves that dependency while preserving the existing keyboard path.Verification
corepack npm run format:uncommittednpx nx lint playground-websitenpx playwright test --config=packages/playground/website/playwright/playwright.config.ts e2e/php-code-snippet.spec.ts --project=chromium --project=webkit -g "pointer activation|repeated mouse clicks|queues clicks|Ctrl\\+Enter"I also ran the full Chromium
php-code-snippet.spec.ts. The new pointer tests passed, but the full run still hit the existing local Vite dev-server issue whereisomorphic-gitdeep imports breakclient/index.jsloading; that failure is unrelated to this change.