Re: : [css-snappoints] elements and nested scrollers

I think what Robert is suggests prevents snap points crossing scroller
boundaries (with the exception of overflow: hidden). However it is
important to also avoid element snap offsets to cause unintended scrollers
to suddenly snap. This can be resolved by separating snap point's
contribution vs snapping.

How about:
-  *contribution*: element contributes a snap position to the nearest
ancestor whose overflow-x is "auto" or "scroll".
-  *snapping*: a scroller snaps to its contributed snap points only when it
has 'scroll-snap-position: elements'

In effect, a scroller may capture snap points but not snap to them unless
explicitly declared.

Also, it makes sense to have  horizontal and vertical snap offsets to be
contributed separately. However this needs the followings to work well:
1. Scrollers to declare snap-type individually for each axis (I know that
Firefox implements this so I imagine this have already been discussed but
missing in the spec.)
 2. Elements to declare snap points individually for each axis (e.g.,
scroll-snap-coordinate-{x,y}). At the moment snap coordinates are
<position> so they always contribute vertical and horizontal values which
is unfortunate.

Here is an example to show the above:
<div id="vertical-outer" style="overflow-y:scroll; scroll-snap-points-y:
repeat(100%);">
  <div id="horizontal-outer" style="overflow-x:scroll;
scroll-snap-points-x: elements;">
    <div id=“intermediate" style="overflow:scroll">
       <span id=“A" style="scroll-snap-coordinate:50%"></span>
    </div>

    <div id=“intermediate-hidden" style="overflow: hidden">
        <span id=“B" style="scroll-snap-coordinate:50% 50%"></span>
    <div>

    <span id=“C" style="scroll-snap-coordinate-y:50%"></span>
  </div>
</div>

intermediate: receives A vertical and horizontal snap offsets but *does
not* snap to it.
intermediate-hidden: does not capture any snap offsets.
horizontal-outer: receives B horizontal snap offset and snaps to it.
vertical-outer: receives B and C vertical snap offset but *does not* snap
to it.

Majid

On Mon, Jun 15, 2015 at 9:15 PM Robert O'Callahan <robert@ocallahan.org>
wrote:

> On Tue, Jun 16, 2015 at 7:23 AM, Simon Fraser <smfr@me.com> wrote:
>
>> In New York, we resolved to add back ‘elements’ as a value for
>> scroll-snap-points-x/y[1].
>>
>> However, I’m having second thoughts. Consider:
>>
>> <div id="outer" style="overflow:scroll; scroll-snap-points-x: elements;>
>>     <div id=“intermediate" style="overflow:scroll">
>>         <div class=“inner" style="scroll-snap-coordinate:50% 50%"></div>
>>         ... more ...
>>     </div>
>> </div>
>>
>> Now, scrolling #intermediate requires that .inner items be snapped to
>> #outer, so as the middle scroller scrolls, the outer scrolling is snapping
>> to different positions. This seems undesirable. In general it seems bad for
>> snapping to ever cross scroller boundaries. In fact, this seems worse than
>> the issue I was trying to address with ‘elements’, which was that something
>> with with "scroll-snap-coordinate” could suddenly start snapping to a
>> different scroller (maybe even the document), if different intermediate
>> elements gain or lose scrollability.
>>
>> There is one possible use case for skipping ancestor scrollers, which is
>> if you want free horizontal scrolling in your immediate scroll container,
>> but snapping on Y to happen on, say, the document.
>>
>
> Can we just say that an element contributes a horizontal scroll position
> to the nearest ancestor whose overflow-x is "auto" or "scroll", and a
> vertical scroll position to the nearest ancestor whose overflow-y is "auto"
> or "scroll"?
>
> Rob
> --
> oIo otoeololo oyooouo otohoaoto oaonoyooonoeo owohooo oioso oaonogoroyo
> owoiotoho oao oboroootohoeoro oooro osoiosotoeoro owoiololo oboeo
> osouobojoeocoto otooo ojouodogomoeonoto.o oAogoaoiono,o oaonoyooonoeo
> owohooo
> osoaoyoso otooo oao oboroootohoeoro oooro osoiosotoeoro,o o‘oRoaocoao,o’o
> oioso
> oaonosowoeoroaoboloeo otooo otohoeo ocooouoroto.o oAonodo oaonoyooonoeo
> owohooo
> osoaoyoso,o o‘oYooouo ofooooolo!o’o owoiololo oboeo oiono odoaonogoeoro
> ooofo
> otohoeo ofoioroeo ooofo ohoeololo.
>

Received on Tuesday, 16 June 2015 12:22:35 UTC