Re: Maintaining the offset of content relative to its overflow box

Il 06/09/2012 23:03, Tab Atkins Jr. ha scritto:
> On Wed, Sep 5, 2012 at 12:27 AM, James Ide <ide@fb.com> wrote:
> Excellent use-case description!  Thanks so much for that; most
> proposals skimp on that, so it's hard to tell what improvements can be
> made to their proposal.  ^_^
+1
>> One currently feasible solution is to use JavaScript to measure the
>> dimensions
>> of an inserted node and scroll its overflow ancestor's contents by the same
>> amount to compensate as necessary. Deciding when to compensate for the
>> inserted node sometimes requires a heuristic since the intent is to maintain
>> the position of the content that the user is reading.
>>
>> I'd like to propose a CSS property, "pinning", that tells the layout engine
>> to
>> maintain the position of visible content relative to its overflow box. I
>> imagine the most common use cases will be for scrollable boxes, but this
>> behavior seems desirable for any box with clipped overflow and a positive
>> scrollTop.
+1
>>
>> The "pinning" property takes up to two values for vertical and horizontal
>> pinning, respectively: [<length>|<percentage>]{1,2}. Each determines a
>> threshold from the top and left of the element's content box; nodes that are
>> laid out before these thresholds do not cause their siblings to be shifted.
> I have a few problems with this proposal.  I suspect that the details
> of your proposal were strongly influenced by the JS library you were
> using; we can do better when we control the language.
>
> 1. It's way too specific.  You need to predict what zone of the
> element you'll be inserting things in.  I think we can do this
> automatically.
> 2. It's not general enough.  You only cover element insertion.
> Element deletion, or just an element changing size, still causes
> shifting in the scroll area.  We can generalize this and cover those
> cases automatically.
>
> Here's an alternate proposal:
>
> scroll-adjust: none | stable  (not super happy with the property name,
> but roll with it)
I sounds better also for me.

Regards

Luca

Received on Friday, 7 September 2012 15:26:11 UTC