Re: [csswg-drafts] [css-selectors] Proposal for allowing selectors that depend on layout (:stuck, :snap, :on-screen, etc) (#5979)

@meduzen You're right to note the difference between targeting the stuck element directly vs the children of the stuck element. But the cause and effect is backwards. The reason we decided to use container queries here is because it would cause issues to target the stuck element itself. If it was possible to target the element directly, without causing layout loops, then a pseudo-class would have been a good option. Container queries give us one level of separation, and the ability to add essential 'containment' to the stuck element – so that changes within the query are not able to change the result of the query.

I think we all understand that it would be _nicer_ if it wasn't required, but the re-targeting to children is what makes this feature possible.

-- 
GitHub Notification of comment by mirisuzanne
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5979#issuecomment-3189028531 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 14 August 2025 16:12:19 UTC