W3C home > Mailing lists > Public > www-style@w3.org > April 2016

RE: [css-position] events for position sticky

From: Francois Remy <francois.remy.dev@outlook.com>
Date: Tue, 19 Apr 2016 10:20:24 -0700
Message-ID: <DUB408-EAS191D2F5B1185B418AFA86B6A56C0@phx.gbl>
To: "'Aurelio De Rosa'" <a.derosa@audero.it>, <www-style@w3.org>
> From: Aurelio De Rosa [mailto:a.derosa@audero.it] 
> Last month http://lists.w3.org/Archives/Public/www-style/2016Mar/0252.html to demonstrate what the problem is with the current state of position: sticky, but until now I haven't received any reply.
> Can someone please give me a feedback about the possibility to introduce some events?

I think it would be great if the specification authors could weigh in here. Personally, though, I believe the reply you got at the time still makes sense: If you want to transform the element when it reaches the top, position:sticky cannot be optimized for you properly anyway, so you should rely on the scroll events (or in a not-too-distant-future the new IntersectionObserver API) to detect when you want to switch to the other design. 

Position:sticky box are still layouted where they are supposed to be without position:sticky, but then are painted at some other area. This can be seen here [1], see of the float from the flow still affects the layout once sticky is applied. Position:sticky is a paint effect, not a layout effect. It is applied in the composition thread.
 
I wouldn’t change the css properties of the box, though, I would duplicate the box and have the position:fixed one be aria-hidden=true (and display:none when not needed), and the other one become visibility:hidden whenever you toggle on the display of the fixed one.

[1] https://jsfiddle.net/Lt4f1xe1/1/
Received on Tuesday, 19 April 2016 17:20:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:02 UTC