Commit Graph

2 Commits

Author SHA1 Message Date
Andrey Lushnikov
254bc80811
chore: cleanup ElementHandle.isIntersectingViewport (#2874)
This patch:
- simplifies test reusing the `offscreenbuttons.html` asset
- aligns IntersectionObserver usage with the one we have for
  `ElementHandle._scrollIntoViewIfNeeded`.
2018-07-11 21:04:36 -07:00
Andrey Lushnikov
f55d005cbe
fix(page): teach page.click() to click partially offscreen buttons (#2806)
Originally, we use `Element.scrollIntoViewIfNeeded` to make sure
button is on screen before trying to click it.

However, `Element.scrollIntoViewIfNeeded` doesn't work in certain
scenarios, e.g. when element is partially visible and horizontal
scrolling is required to make it fully visible.

This patch polyfills `element.scrollIntoViewIfNeeded` using
IntersectionObserver and `Element.scrollIntoView`.

Fixes #2804.
2018-06-26 18:00:55 -07:00