Scrolling option `block: end` should be `block: center`
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 718
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
To scroll into view an element perform the following steps only if the element is not already in view:
Let options be the following ScrollIntoViewOptions:
Logical scroll position "block"
"end"
Logical scroll position "inline"
"nearest"
In case the element is bigger than the scrollable element, the element center to be clicked does not get scrolled into the view.
data:text/html;charset=utf-8,<div` style="height: 200px; overflow: scroll;"><div id="a" onclick="alert(JSON.stringify('y: ' + (this.parentNode.scrollTop + event.clientY)))" style="background: linear-gradient(0deg, rgba(255,0,0,1) 0%, rgba(255,0,0,1) 48%, rgba(0,255,0,1) 50%, rgba(255,0,0,1) 52%, rgba(255,0,0,1) 100%); width: 800px; height: 1000px;"></div></div>
This is a data url showing a green line in the center of the element, as soon as the element is clicked the element must be scrolled in to view.
The element should be clicked at its center, so i would expect the UI in this state:
But the element is scolled to the lower end, as specified by the spec and then clicked:
The alert does show the coordinates clicked, which are also not the correct ones.
The webdriver does click the center of the visible part, which should be correct when the element is scrolled into view using block: center.
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 the quoted WebDriver scroll-into-view steps and reproduce the supplied data URL to observe the current click position. Compare the block: end behavior with the requested block: center behavior; done means the element's visible center is used for the click when it is larger than its scrollable container.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- devtools, testing
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100