Open zbianca opened 4 years ago
My understanding is that two conditions need to be described, as follow:
→ If element edge A and element edge B are both inside scrolling box edge A and scrolling box edge B → If element edge A is outside scrolling box edge A and element edge B is outside scrolling box edge B Do nothing.
→ If element edge C and element edge D are both inside scrolling box edge C and scrolling box edge D → If element edge C is outside scrolling box edge C and element edge D is outside scrolling box edge D Do nothing.
By this description nothing is done only when the element is bigger
But if both A and B edges are inside, then the other conditions do not hold. So nothing is done either.
Then the spec seems fine already, your proposal would be just for completeness/clarification, right?
Yes, for completeness and clarity. Another option (just stating, not recommending it) would be to remove any "do nothing" cases then.
As long as there's no else
statement at the end of the list, you could say the spec is fine already. But is it?
If you remove the initial "do nothing" case, then the other conditions may match when they are not supposed to.
Indeed.
To me the first condition illustrates only one possible situation: the element height is greater than the viewport and the element is currently taking all of the viewport. Please correct me if there's another possible situation. I'd be more secure about it if there was a 'respectively' there.
And with that consideration on the 1st condition when we get to the 3rd and 4th conditions we make sure that the opposite element edge not mentioned is inside its respective scrolling box edge without ever using the word inside. Maybe that was the intention here..
Back to my initial suggestion, from a practical point of view, knowing what happens when both edges are in view is extremely helpful since using "nearest" is the only way to achieve no scrolling ("do nothing").
https://drafts.csswg.org/cssom-view/#element-scrolling-members
By this description nothing is done only when the element is bigger than the viewport. However, another situation when nothing is done is when both edges are inside the box edges. The same is valid for when
inline is "nearest"
on item 9.8.