Files
Julien Wajsberg ebb5a37b22 Bug 2038932 - Skip zero-size rects when computing click/pointer centre points r=jdescottes
An inline element wrapping a block-level child produces zero-size line-box
rects at the start and end of its getClientRects() list, e.g.
[0x0@(0,0.5), 32x32@(0,0.5), 0x0@(0,32.5)]. When the element sits at a
fractional y-coordinate, applying Math.floor to the zero-size rect's y
(e.g. floor(0.5) = 0) produces a point outside the element, causing
elementsFromPoint to miss it and isInView to return false, which results in
an "element not interactable: could not be scrolled into view" error.

The fix introduces dom.getFirstNonZeroRect() and uses it everywhere a rect
is selected from getClientRects() to compute a centre point:
- DOM.sys.mjs: getPointerInteractablePaintTree (used by isInView)
- interaction.sys.mjs: webdriverClickElement and seleniumClickElement
- Actions.sys.mjs: getOriginCoordinates

Also see the Webdriver spec bug in https://github.com/w3c/webdriver/issues/1961

Differential Revision: https://phabricator.services.mozilla.com/D301281
2026-06-03 16:13:29 +00:00
..
…