Skip to content

Fix PHP snippet Run button pointer activation - #3639

Merged
adamziel merged 1 commit into
trunkfrom
codex/php-snippet-click-debug
May 14, 2026
Merged

Fix PHP snippet Run button pointer activation#3639
adamziel merged 1 commit into
trunkfrom
codex/php-snippet-click-debug

Conversation

@adamziel

Copy link
Copy Markdown
Collaborator

What changed

  • Starts PHP snippet Run button execution on primary pointerdown instead of waiting only for the final browser click event.
  • Suppresses the follow-up synthetic pointer click so normal mouse activation still runs once.
  • Keeps keyboard/programmatic click behavior on the existing click path.
  • Adds Playwright coverage for canceled pointer clicks and repeated real mouse clicks.

Why

Cmd/Ctrl+Enter was reliable because it calls _run() directly. Pointer activation could still disappear if the browser did not dispatch the final click event after a press/release sequence, making the Run button look like every other click was ignored. Starting from pointerdown removes that dependency while preserving the existing keyboard path.

Verification

  • corepack npm run format:uncommitted
  • npx nx lint playground-website
  • npx 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 where isomorphic-git deep imports break client/index.js loading; that failure is unrelated to this change.

@adamziel adamziel changed the title [codex] Fix PHP snippet Run button pointer activation May 14, 2026
@adamziel
adamziel marked this pull request as ready for review May 14, 2026 15:36
@adamziel
adamziel requested review from a team, ashfame and Copilot May 14, 2026 15:36
@adamziel
adamziel merged commit 5498411 into trunk May 14, 2026
51 of 52 checks passed
@adamziel
adamziel deleted the codex/php-snippet-click-debug branch May 14, 2026 15:36

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.

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) click so a single mouse press still results in one run; keep click path 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();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment