Issue 1:
Context:

Playwright Version: 1.4.2

Operating System: Mac

Node.js version: 12

Browser: Chromium

Extra: NA

Describe the bug

elementHandle.scrollIntoViewIfNeeded won't scroll if the element is partially visible. I think this might be unexpected behavior but I don't see any details about this method on CDP.

2020-10-14T02:00:16.457Z pw:api => elementHandle.scrollIntoViewIfNeeded started
2020-10-14T02:00:16.458Z pw:api waiting for element to be visible and not moving
2020-10-14T02:00:16.481Z pw:api element is visible and does not move
2020-10-14T02:00:16.482Z pw:api <= elementHandle.scrollIntoViewIfNeeded succeeded

Here's the page with selected element that I am trying to scroll into view

Issue 2:
Context:

Playwright Version: 1.2.1

Operating System: Ubuntu Bionic (docker image)

Node version: 12.18.0 (ubuntu) / 12.16.2 (win)

Browser: HeadlessChrome/85.0.4182.0 (ubuntu)

Hello, guys.

I am working on puppeteer -> playwright migration and faced an issue that did not happen with puppeteer, but happens with playwright for some reason.

I have a list of items, one of them is partially visible. Header overlaps it. I pointed my mouse over it and it's highlighted at the moment:

I use simple click with the only one parameter click count = 1. No other flags are set.

According to this doc:

position A point to click relative to the top-left corner of element padding box. If not specified, clicks to some visible point of the element.

PW should click to some visible point of the element. But it does not happen:

Timeout 30000ms exceeded during page.click.
===================== page.click logs =====================
[api] waiting for selector "[data-test-id^="Nav.Country.222"]"
[api] selector resolved to visible <div tabindex="0" role="button" aria-disabled="false"…>…</div>
[api] attempting page.click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (149.5,187)
[api] element does not receive pointer events
[api] retrying page.click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (149.5,187)
[api] element does not receive pointer events
[api] retrying page.click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (149.5,187)
[api] element does not receive pointer events
[api] retrying page.click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (149.5,187)
[api] element does not receive pointer events
[api] retrying page.click action
[api] waiting for element to be visible, enabled and not moving
[api] element is visible, enabled and does not move
[api] scrolling into view if needed
[api] done scrolling
[api] checking that element receives pointer events at (149.5,187)
[api] element does not receive pointer events
[api] retrying page.click action

I used https://chrome.google.com/webstore/detail/coordinates/bpflbjmbfccblbhlcmlgkajdpoiepmkd to check the coordinates and it seems that PW selects coordinates of invisible part. I am not 100% sure, because I was not able to reproduce the issue on Windows in debug mode, but it happens often with docker tests.

I'll be happy to provide some additional info for you, just let me know.

Update:

As a workaround I added one scroll into view for the element to be sure that it's fully visible and ready for clicks.

But it would be nice to have a permanent solution.