Open
Description
test_driver.click()
has issues when targeting an element of which only a sliver is visible at the bottom of the viewport. This happens in css/selectors/focus-visible-018-2.html
.
test_driver.click()
is basically this:
let box = element.getClientRects[0];
let middle = centerOfBoxClippingToViewport(box);
let elements = document.elementsFromPoint(middle.x, middle.y)
if (!elements)
element.scrollIntoView();
box = element.getClientRects[0];
middle = centerOfBoxClippingToViewport(box);
dispatch_simulated_click(middle.x, middle.y);
Now consider this scenario: the target element has a clientRect.top of 599.5px. element.getClientRects()
returns a value with fractional pixels, returns a rect that is 0.5px tall in a 600px tall viewport, and we compute the center with y=599.75. document.elementsFromPoint()
at that location succeeds in finding the element, because it takes fractional coordinates.
Now we dispatch a simulated click, which floors the x and y coords, since mouseEvent.x and y are long
, so we dispatch an event with y=599, and fail to hit the element.