[csswg-drafts] [css-position] Proposal for new 'position' value: fixed-to-parent (#8066)

jez9999 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-position] Proposal for new 'position' value: fixed-to-parent ==
At present the CSS `position` can be set to static, relative, absolute, fixed, or sticky:
https://w3c.github.io/csswg-drafts/css-position/#position-property

I'd like a new value added: `fixed-to-parent`.  This would behave similarly to `fixed`, but the element would instead be positioned and sized relative to the nearest block-level ancestor element.

**Motivation**
I've been trying to create a "mask" element over my overflowing content, which receives a scrollbar, whereby the mask itself doesn't overlay the scrollbar.  The closest I came to sort-of getting it working was this:
https://game-point.net/misc/stickyMaskOverScroll/index.htm

It uses a combination of grid layout and sticky to get the mask to stay fixed relative to its container, allowing the sibling's content to overflow and scroll, but it doesn't work in Firefox and I think it's lucky it works in Chrome because it doesn't really seem to be guaranteed behaviour in the CSS spec; as I'm using `max-height` instead of `height` to size the container, the height of the grid's row should be set to `auto`, so really the mask element should not have the height that it does.

I think what I'm trying to do is a fundamentally new behaviour which, whilst it would seem to be relatively feasible to implement with existing rendering engines, isn't currently producible.  It surprises me that there isn't a way to do this currently as it's quite common to have content scrolling through overflow, and if you wanted to put a mask over the viewing area / container, or maybe fix some widget relative to the container, you couldn't do it right now.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8066 using your GitHub account


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

Received on Sunday, 13 November 2022 16:39:56 UTC