- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Thu, 11 Feb 2021 18:39:05 +0000
- To: public-css-archive@w3.org
I don't think this restriction is enough. Being able to select the contents means that you can affect the size of the sticky element through auto sizes, and thus whether it's stuck or not. See [demo](https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cstyle%3E%0A%23container%20%7B%0A%20%20height%3A%20100px%3B%0A%20%20overflow%3A%20scroll%3B%0A%20%20border%3A%20solid%3B%0A%7D%0A%23container%3A%3Abefore%20%7B%0A%20%20content%3A%20%27%27%3B%0A%20%20display%3A%20block%3B%0A%20%20height%3A%2050px%3B%0A%7D%0A%23sticky%20%7B%0A%20%20position%3A%20sticky%3B%0A%20%20bottom%3A%200%3B%0A%20%20background%3A%20orange%3B%0A%7D%0A%23sticky.stuck%20%3E%20*%20%7B%0A%20%20display%3A%20none%3B%0A%7D%0A%23contents%20%7B%0A%20%20height%3A%20200px%3B%0A%7D%0A*%20%7B%20flex-shrink%3A%200%20%7D%0A%3C%2Fstyle%3E%0A%3Cdiv%20id%3D%22container%22%3E%0A%20%20%3Cdiv%20id%3D%22sticky%22%3E%0A%20%20%20%20%3Cdiv%20id%3D%22contents%22%3E%3C%2Fdiv%3E%0A%20%20%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A%3Cscript%3E%0A%2F%2F%20Polyfill%20%3Astuck%0Avar%20sticky%20%3D%20document.getElementById(%22sticky%22)%3B%0A(function%20f()%20%7B%0A%20%20const%20prev%20%3D%20sticky.getBoundingClientRect()%3B%0A%20%20sticky.style.position%20%3D%20%22relative%22%3B%0A%20%20const%20current%20%3D%20sticky.getBoundingClientRect()%3B%0A%20%20const%20eq%20%3D%20prev.x%20%3D%3D%3D%20current.x%20%26%26%20prev.y%20%3D%3D%3D%20current.y%20%26%26%20prev.width%20%3D%3D%3D%20current.width%20%26%26%20prev.height%20%3D%3D%3D%20current.height%3B%0A%20%20sticky.style.position%20%3D%20%22%22%3B%0A%20%20sticky.classList.toggle(%22stuck%22%2C%20!eq)%3B%0A%20%20setTimeout(f%2C%20200)%3B%0A%7D)()%3B%0A%3C%2Fscript%3E), which uses JS to crudely polyfill `:stuck` as `.stuck`, and only uses it in `#sticky.stuck > *`. It flickers since `.stuck` keeps toggling. This circularity may be more obvious for similar proposals like `:overflowed-content` (#2011). Changing the contents can clearly affect whether the element has overflowing contents. -- GitHub Notification of comment by Loirooriol Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5979#issuecomment-777703909 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 11 February 2021 18:39:07 UTC