pageboard / client

Web site building system - client packages
MIT License
4 stars 0 forks source link

sticky: drop polyfill in favor of events #161

Open kapouer opened 3 years ago

kapouer commented 3 years ago

CSS Sticky is supported by all modern browsers. However, we currently need sticky events to toggle a stuck/unstuck class.

Sticky events are currently implemented using 'top' and 'bottom' helpers, before and after the sticky node. To be able to do that and keep html editor compatibility, one has to place them in a "shadow root":

<element-sticky>
   <div contenteditable=false myTopHelper />
   <div block-content />
   <div contenteditable=false myBottomHelper />
</element-sticky>

The custom element here wouldn't carry the sticky class, only the block-content would: this is a breaking change for CSS.

kapouer commented 3 years ago

Actually we don't need this ! https://css-tricks.com/how-to-create-a-shrinking-header-on-scroll-without-javascript/ https://css-tricks.com/creating-a-smart-navbar-with-vanilla-javascript/