fix(api): clarify Window scroll options#44116
Conversation
|
Preview URLs (4 pages)
(comment last updated: 2026-05-14 16:38:28) |
chrisdavidmills
left a comment
There was a problem hiding this comment.
Hi there @Ashish-CodeJourney, and thank you for your work on this.
I have some comments for you to consider.
| - `options` | ||
| - : An object containing the following properties: | ||
| - `top` | ||
| - : Specifies the number of pixels along the Y axis to scroll the window or element. |
There was a problem hiding this comment.
I think the original wording was fine in these cases. In your new wording, "to scroll by along" is not grammatically good. Revert these two changes?
There was a problem hiding this comment.
Thanks, agreed. I reverted these two descriptions to the original wording.
| - : The pixel along the vertical axis of the document that you want displayed in the upper left. This is the same as the `yCoord` parameter. | ||
| - `left` | ||
| - : Specifies the number of pixels along the X axis to scroll the window or element. | ||
| - : The pixel along the horizontal axis of the document that you want displayed in the upper left. This is the same as the `xCoord` parameter. |
There was a problem hiding this comment.
I won't comment on each of xCoord, yCoord, top, and left individually, but ... isn't this wording a bit confusing in general? Shouldn't these descriptions say something more along the lines of
The
xcoordinate of the position in the viewport that you want to scroll to...?
There was a problem hiding this comment.
@Ashish-CodeJourney, everything else looks fine, but I still think this kind of wording on the scrollTo pages is confusing.
Maybe this:
The
xcoordinate of the document that you want the viewport's left edge to scroll to.
And similar for the other descriptions?
?
|
@chrisdavidmills Thanks for the review. I have worked on the suggestions, |
chrisdavidmills
left a comment
There was a problem hiding this comment.
@Ashish-CodeJourney the rest of it looks fine now, but I think this comment still needs addressing:
agreed. I updated the I also applied the equivalent wording to |
992b69e to
4311101
Compare
chrisdavidmills
left a comment
There was a problem hiding this comment.
Awesome, this is looking good, thanks again for all your work on this, @Ashish-CodeJourney.
Merging.
|
Thanks all for your work on a quick fix! |
Description
Clarifies that
Window.scrollTo()options use absolute document coordinates, whileWindow.scrollBy()options use relative scroll amounts. Also aligns thebehavioroptiondescription between both pages.
Motivation
The previous
topandleftdescriptions looked similar forscrollTo()andscrollBy(), which could make readers think both methods use delta values. This update makes theabsolute versus relative behavior explicit.
Additional details
Tested with:
npx --no-install markdownlint-cli2 files/en-us/web/api/window/scrollto/index.md files/en-us/web/api/window/scrollby/index.mdnpx --no-install prettier -c files/en-us/web/api/window/scrollto/index.md files/en-us/web/api/window/scrollby/index.mdRelated issues and pull requests
Fixes #44098