W3C home > Mailing lists > Public > www-style@w3.org > August 2013

Re: :stuck psuedo class WAS: specifying position:sticky

From: Simon Fraser <smfr@me.com>
Date: Wed, 28 Aug 2013 13:04:25 -0700
Cc: Corey Ford <cford@mozilla.com>, "www-style@w3.org" <www-style@w3.org>, "L. David Baron" <dbaron@dbaron.org>
Message-id: <F19C27D2-D220-43E2-96A8-62F5A6A77B8E@me.com>
To: Ojan Vafai <ojan@chromium.org>
On Aug 27, 2013, at 5:34 PM, Ojan Vafai <ojan@chromium.org> wrote:

> This may be too early, but I think we should add a pseudo-class for position:sticky's that are stuck to an edge. This lets you easily style the stuck element (e.g. with a box-shadow).
> 
> 
> On Tue, Jul 23, 2013 at 6:19 PM, Corey Ford <cford@mozilla.com> wrote:
> On 7/12/13 9:37 AM, Corey Ford wrote:
> For any of 'top', 'bottom', 'left', and 'right' that are not 'auto', if the box's normal position would cause that edge of its margin box to be less than the specified distance within that padding edge of its scrolling container, the box is repositioned to that distance from the edge
> 
> Percentage values of these properties reference the padding box of the scrolling container.
> 
> The content box of the scrolling container would also be reasonable at these points in the calculations. (I'm not entirely sure what I see WebKit doing, but it doesn't seem to be either.)
> 
> Corey

We considered a pseudoclass like this, as it’s common to see sites changing the style of an element when it drops into the “stuck” state.

The problem is that it defeats one of the main optimizations which drove our creation of a declarative sticky behavior, which is that we want to be able to delegate the implementation of the sticky behavior to another thread, the thread on which scrolling happens (keeping it off the main thread means that scrolling can remain responsive even when the main thread is busy doing layout/painting). If we have to do layout when an element enters or leaves the sticky state, then we’ll have to do that back on the main thread, which would result in a scrolling stutter.

Simon


Received on Wednesday, 28 August 2013 20:04:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:33 UTC