React Click Event Dispatch Fix is a development Claude Skill built by Dylan Bochman. Best for: Automation engineers using Pinchtab, Puppeteer, or Playwright to interact with React SPAs (OpenTable, Airbnb) when programmatic clicks fail to trigger handlers or navigation..
Trigger React event handlers in headless browser automation by dispatching full MouseEvent sequences with real coordinates instead of using .click().
When automating React-based websites with Pinchtab (or any headless browser tool that uses
element.click() via JavaScript eval), React's synthetic event system may not process the
click. The element's native click fires but React's event delegation doesn't pick it up,
so no navigation or state change occurs.
pinchtab eval "element.click()" runs successfully (no error) but nothing happenspinchtab snap -i -c may not show the target elements in the accessibility tree
(e.g., <a href="" role="button"> elements with empty href)Replace element.click() with a full MouseEvent dispatch sequence using real coordinates:
const rect = element.getBoundingClientRect();
const x = rect.x + rect.width / 2;
const y = rect.y + rect.height / 2;
const opts = { bubbles: true, cancelable: true, clientX: x, clientY: y, button: 0 };
element.dispatchEvent(new MouseEvent('mousedown', opts));
element.dispatchEvent(new MouseEvent('mouseup', opts));
element.dispatchEvent(new MouseEvent('click', opts));
Key requirements:
clientX/clientY from getBoundingClientRect() (React uses these for event delegation)bubbles: true: Events must bubble up to React's root event listenerReact uses event delegation — it attaches a single event listener at the root DOM node and
dispatches synthetic events based on the event target and coordinates. A simple .click()
call creates a click event but may not include the coordinates or preceding mousedown/mouseup
events that React's event system expects.
After dispatching, check that the page navigated or state changed:
// Wait a few seconds, then check
const url = window.location.href;
const title = document.title;
From the OpenTable booking script (opentable-book.sh):
// Find the best timeslot
const els = Array.from(document.querySelectorAll('a[role=button]'));
const timeEls = els.filter(e => /\d:\d\d [AP]M/.test(e.textContent.trim()));
// ... find closest to target time ...
// Click with full MouseEvent sequence
const rect = best.getBoundingClientRect();
const x = rect.x + rect.width/2;
const y = rect.y + rect.height/2;
const opts = {bubbles:true, cancelable:true, clientX:x, clientY:y, button:0};
best.dispatchEvent(new MouseEvent('mousedown', opts));
best.dispatchEvent(new MouseEvent('mouseup', opts));
best.dispatchEvent(new MouseEvent('click', opts));
click <ref> command should work correctly (it dispatches real
CDP input events), but some elements don't appear in pinchtab's accessibility tree snapshot
(e.g., <a href="" role="button"> with empty href), making native click unusablepinchtab click <ref> when the element IS in the snap tree.click() usually works fine/plugin install react-click-event-dispatch-fix@DbochmanRequires Claude Code CLI.
Automation engineers using Pinchtab, Puppeteer, or Playwright to interact with React SPAs (OpenTable, Airbnb) when programmatic clicks fail to trigger handlers or navigation.
No reviews yet. Be the first to review this skill.