-
Notifications
You must be signed in to change notification settings - Fork 756
Description
From a discussion about scrollOptions in whatwg/html#2787 (comment) ...
As for the preferred position of the focused element, the CSS Scroll Snap module already defines various parameters for the preferred scroll positions for viewing an element, and imho it is better to re-use these rather than establish a contradictory and less powerful set of arguments in the .focus() API. The
scroll-paddingproperty already specifies that it applies, and probablyscroll-snap-marginshould as well. The spec currently avoids specifying that focusing operations inherently trigger snapping to the element’s snap position, but it does specify that (even when snapping is off), a #fragmentID-targetted element should snap into position... so if this is desired behavior we can look into defining that behavior as well. In any case, it doesn't seem like this belongs specifically in the JS API, unless for some reason the behavior of an API call needs to differ from that of a user-triggered event.
Possible guidance to consider:
- Suggesting that scroll-into-view operations consider scroll-snap-margin in addition to scroll-padding
- Recommending that UAs use the element's snap position if it has one and snapping is on.
- Allowing UAs to use the suggested snap position, if the element has defined one, even if snapping is off.