You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Chromium locator.tap misses its target after the visible viewport pans #44121
git clone --depth 1 --branch repro/devon-visual-viewport-tap https://github.com/devonjonte/bench-hashes.git tap-repro
cd tap-repro
npm ci
npx playwright install chromium
npm test
The script uses page.setContent, a 1534-pixel-wide container and two buttons. It tests identical 1200×900 touch contexts with isMobile: false, then true. No server or application framework is involved.
Expected behavior
locator('#target').tap() reaches the target in both contexts.
Actual behavior
The ordinary touch context passes. The mobile context times out:
After scrolling in the mobile context, visualViewport.offsetLeft is 118. The target's getBoundingClientRect() centre is x=1213. A direct touchscreen tap at x=1095, subtracting the visual offset, reaches the intended button in a separate control. The locator action still fails with current Playwright. Version 1.55.1 also exhibits the issue.
Reporting this reproduction for maintainer triage. No implementation or PR is planned without assignment or approval.
Hi, I'm the Playwright bot. I reproduced this and prepared a fix.
Reproduced in Chromium 159.0.8154.6 on Linux, using Playwright 1.66.0-next at 826ce42b8664ea940424e77ce51f1cdf96dcd37f. Chromium returns element positions relative to the visible viewport, but Playwright checked those positions against the layout viewport. That check reported <main> as an obstruction before sending the tap. The fix converts the coordinates for this check; touch event coordinates remain unchanged.
The existing locator tap test now covers a mobile page that pans horizontally and vertically. Firefox does not support isMobile, so its test uses an ordinary touch context.
Before the fix, the extended Chromium locator tap test timed out. A final check with the conversion removed failed only in Chromium; Firefox and WebKit passed. Restoring it made all three pass.
A separate Chromium coordinate check measured visualViewport.offsetLeft = 334: the button's layout x-position was 1200, but its protocol x-position was 866. Forced taps and clicks reached the button, and their event clientX was 1225.
The same coordinate control passed in WebKit 27.2 with mobile emulation and Firefox 159.0 with ordinary touch emulation. Both had zero visual viewport offset.
After the fix, the locator regression passed in all three browsers, both headless and headed.
tap.spec.ts, browsercontext-viewport-mobile.spec.ts, page-click.spec.ts, page-click-scroll.spec.ts, and elementhandle-bounding-box.spec.ts: 396 passed, 18 skipped across the three browsers.
npm run build and npm run flint passed.
The reported published versions, 1.65.1 and 1.55.1, were not rerun: the failure reproduced on the current source.
Activity
microsoft-playwright-automation commentedon Nov 16, 2026
microsoft-playwright-automation commentedon Nov 16, 2026
Hi, I'm the Playwright bot. I reproduced this and prepared a fix.
Reproduced in Chromium 159.0.8154.6 on Linux, using Playwright
1.66.0-nextat826ce42b8664ea940424e77ce51f1cdf96dcd37f. Chromium returns element positions relative to the visible viewport, but Playwright checked those positions against the layout viewport. That check reported<main>as an obstruction before sending the tap. The fix converts the coordinates for this check; touch event coordinates remain unchanged.The existing locator tap test now covers a mobile page that pans horizontally and vertically. Firefox does not support
isMobile, so its test uses an ordinary touch context.Condensed reproduction
Checks and browser differences
visualViewport.offsetLeft = 334: the button's layout x-position was 1200, but its protocol x-position was 866. Forced taps and clicks reached the button, and their eventclientXwas 1225.tap.spec.ts,browsercontext-viewport-mobile.spec.ts,page-click.spec.ts,page-click-scroll.spec.ts, andelementhandle-bounding-box.spec.ts: 396 passed, 18 skipped across the three browsers.npm run buildandnpm run flintpassed.The reported published versions, 1.65.1 and 1.55.1, were not rerun: the failure reproduced on the current source.
Draft PR: #44148
Triaged on Linux by the Playwright bot - agent run
fix(chromium): account for visual viewport offsets in hit testing
fix(chromium): account for visual viewport offsets in hit testing
pavelfeldman commentedon Nov 20, 2026
Looks like a real issue we don't want to invest into at this point. Accepting this as a gap in our implementation.