Re: [css-snappoints] Definition of "nearest ancestor" for scroll-snap-coordinate

I think redefining in terms of containing blocks should address the issues
with the absolute positioned elements.

I am not so certain about fixed and sticky positioned elements which are
positioned relative to viewport and move as the document scrolls. I cannot
think of any usecase where snapping to fixed position element makes sense
and allowing it may result in unexpected scrolling behaviour (imagine an
infinite scrolling page trying to snap to fixed position element!).
Perhaps we should disallow these.

Majid

On Mon, Jun 15, 2015 at 3:33 PM Simon Fraser <simon.fraser@apple.com> wrote:

> The Snap Points spec[1] says, for scroll-snap-coordinate:
>
> > The scroll-snap-coordinate property is used to define the x and y
> coordinate within the element which will align with the nearest ancestor
> scroll container’s snap-destination for the respective axis.
>
> The question is what “nearest ancestor” means here. Consider:
>
> <div style="position: absolute;>
>   <div style="overflow:scroll">
>     <div style="position: absolute; scroll-snap-coordinate: 50% 50%"></div>
>   </div>
> </div>
>
> Here the inner <div> doesn’t actually scroll with the scroller, because it
> is positioned, with its containing block is outside the scroller. So it
> doesn’t make sense for "scroll-snap-coordinate” to cause snapping in that
> intermediate scroller.
>
> So I think “nearest ancestor” needs to actually be worded in terms of
> containing blocks.
>
> Simon
>
> [1] http://dev.w3.org/csswg/css-snappoints/#scroll-snap-coordinate
>

Received on Monday, 22 June 2015 12:11:35 UTC