Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(click): revert layout shift logic #10653

Merged
merged 1 commit into from Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/playwright-core/src/server/dom.ts
Expand Up @@ -407,7 +407,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
const point = roundPoint(maybePoint);
progress.metadata.point = point;

if (process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK)
if (!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK)
return this._finishPointerAction(progress, actionName, point, options, action);
else
return this._finishPointerActionDetectLayoutShift(progress, actionName, point, options, action);
Expand Down
4 changes: 4 additions & 0 deletions tests/hit-target.spec.ts
Expand Up @@ -45,6 +45,8 @@ it('should block all events when hit target is wrong', async ({ page, server })
});

it('should block click when mousedown succeeds but mouseup fails', async ({ page, server }) => {
it.skip(!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK);

await page.goto(server.PREFIX + '/input/button.html');
await page.$eval('button', button => {
button.addEventListener('mousedown', () => {
Expand Down Expand Up @@ -82,6 +84,8 @@ it('should click when element detaches in mousedown', async ({ page, server }) =
});

it('should not block programmatic events', async ({ page, server }) => {
it.skip(!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK);

await page.goto(server.PREFIX + '/input/button.html');
await page.$eval('button', button => {
button.addEventListener('mousedown', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/tap.spec.ts
Expand Up @@ -48,7 +48,7 @@ it('trial run should not tap', async ({ page }) => {
await page.tap('#a');
const eventsHandle = await trackEvents(await page.$('#b'));
await page.tap('#b', { trial: true });
const expected = process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK ? [] : ['pointerover', 'pointerenter', 'pointerout', 'pointerleave'];
const expected = !process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK ? [] : ['pointerover', 'pointerenter', 'pointerout', 'pointerleave'];
expect(await eventsHandle.jsonValue()).toEqual(expected);
});

Expand Down