I know this has been asked before but there’s no definitive answer on that question.
MDN says:
Even when the wheel event does trigger scrolling, the
delta*
values in the wheel event don’t necessarily reflect the content’s scrolling direction.
However, the spec says:
If a user agent scrolls as the default action of the wheel event then the sign of the delta SHOULD be given by a right-hand coordinate system where positive X, Y, and Z axes are directed towards the right-most edge, bottom-most edge, and farthest depth (away from the user) of the document, respectively.
And the full-page example in this question that reported the opposite behaviour in Edge seems to now give expected sign of delta*
suggesting it indeed was a bug that was fixed in Edge.
Also, on a discussion about this on Bugzilla, a comment by a representative, suggests that the spec is clear and that the sign of delta*
should indeed indicate the direction of the resulting (if any) scroll event in the expected way (negative deltaX
means left, positive means right; negative deltaY
means down, positive means up).
So my questions are:
- Why does the MDN page says that the sign of the
delta*
values doesn’t necessarily reflect scrolling direction? Am I misunderstanding what they mean in the sentence above? Is it because the spec says “SHOULD” rather than “MUST”? - As developers, can we safely assume that signs of
delta*
reflect the direction of the would-be scroll action? gsap seems to assume this…
3