In-view center point algorithm is wrong for elements larger than the viewport
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 718
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
In chapter 12. Elements, section 12.1 Interactability:
An element’s in-view center point is the origin position of the rectangle that is the intersection between the element’s first DOM client rectangle and the initial viewport. Given an element that is known to be in view, it can be calculated this way:
Let rectangle be the first element of the DOMRect sequence returned by calling getClientRects on element.
Let left be max(0, min(x coordinate, x coordinate + width dimension)).
Let right be min(innerWidth, max(x coordinate, x coordinate + width dimension)).
Let top be max(0, min(y coordinate, y coordinate + height dimension)).
Let bottom be min(innerHeight, max(y coordinate, y coordinate + height dimension)).
Let x be floor((left + right) ÷ 2.0).
Let y be floor((top + bottom) ÷ 2.0).
Return the pair of (x, y).
The algorithm never intersects the viewport with the first DOM client rect. So, the IVCP computed by the algorithm could be offscreen. A test case is the
element on apple.com, which is ~8000px tall. The Element Click command should click the middle of the element as it is exposed within the viewport.Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with section 12.1, Interactability, and compare the in-view center point steps with the WebDriver definition of the intersection between an element and the initial viewport. Use the oversized
element on apple.com as the reported case. Done means the specified center point remains within the viewport and represents the exposed middle of the element.Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100