[cssom-view] Clarify fallback for left and top options of scrollBy when absent

Open Beginner friendly
#2,978 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
css
Domain
documentation

Research direction

Start with the CSSOM View specification sections linked in the issue, comparing the element.scrollBy and window.scrollBy algorithms. Clarify that absent left and top values fall back to 0 before the scroll offsets are added, and ensure both algorithms state this unambiguously.

Written by the indexing model from the issue text.

Description

cssom-view-1

For the one-parameter version of element.scrollBy and window.scrollBy, we have the following algorithms:

From https://drafts.csswg.org/cssom-view/#dom-element-scrollby:

Let options be the argument.
Normalize non-finite values for left and top dictionary members of options, if present.
Add the value of scrollLeft to the left dictionary member.
Add the value of scrollTop to the top dictionary member.
Act as if the scroll() method was invoked with options as the only argument.

From https://drafts.csswg.org/cssom-view/#dom-window-scrollby:

Normalize non-finite values for the left and top dictionary members of options.
Add the value of scrollX to the left dictionary member.
Add the value of scrollY to the top dictionary member.
Act as if the scroll() method was invoked with options as the only argument.

Adding scroll values when left or top are absent would lead to NaN and hence scroll() later would normalize the coordinates to 0. I think what we want instead is to fallback to 0 before adding the scroll values.

Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from w3c/csswg-drafts

All issues in w3c/csswg-drafts

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.