You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
filter should be defined to establish a containing block for fixed and absolutely positioned elements #11
As resolved in http://www.w3.org/2015/02/10-fx-minutes.html#action02 and mentioned in the introduction to the spec, 'filter' not 'none' should create a containing block for absolutely and fixed positioned elements.
I'm concerned that this will make it impossible to apply a filter (e.g., for accessibility to change the color) to an entire webpage without messing up fixed-position elements. This is because there is no HTML
element exposed to the developer which is the containing block for fixed-position elements.
Reacted by Lonnie Best, Nantris, Solomon Ucko, Neptilo, Oliver Foster, Saif Helal, NYPD and Phvli
In browsers that support backdrop-filter, you can put a fixed element on top of everything (with pointer-events: none) and apply the filter you want as that element's backdrop filter. But that's more a workaround than a true solution.
A better solution would be the ability to set the filter directly on the containing block for fixe-position elements. I don't know how you would expose that.
I may have misunderstood your comment, but, aria-hidden only hides the container and its descendants from an AT (screen reader/screen magnifier, etc.) and it does not impact the visibility of the element or its descendants.
Rich Schwerdtfeger
----- Original message -----From: chrishtr notifications@github.comTo: w3c/fxtf-drafts fxtf-drafts@noreply.github.comCc:Subject: Re: [w3c/fxtf-drafts] filter should be defined to establish a containing block for fixed and absolutely positioned elements (#11)Date: Wed, Nov 2, 2016 1:04 PM
I'm concerned that this will make it impossible to apply a filter (e.g., for accessibility to change the color) to an entire webpage without messing up fixed-position elements. This is because there is no HTMLelement exposed to the developer which is the containing block for fixed-position elements.
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.
My comment was not about aria. It was about losing the ability to provide a color or other filter extension
for web pages, without causing the page to display fixed-position elements incorrectly.
Reacted by Lonnie Best, Oliver Foster, Phvli and Daniel F.
The only other idea I have for addressing that case is: We could make filter on the root element special, similar to what we do for overflow and background, and make it always propagate up to the containing block for position:fixed elements.
The Working Group just discussed Filter effects - filters should establish containing blocks for abspos and fixpos, and agreed to the following resolutions:
RESOLVED: follow the existing resolution, add a quirk for filters on the root element to not trap fixpos
The full IRC log of that discussion
<TabAtkins> Topic: Filter effects - filters should establish containing blocks for abspos and fixpos
<TabAtkins> TabAtkins: Filters are morally equivalent to opacity (or vice versa) and opacity establishes a cb, so what's wrong?
<TabAtkins> ericwilligers: People were using extensions to apply a filter ot the whole page, and they didn't want things to rearrange
<TabAtkins> TabAtkins: Ah, it would break fixpos in that case.
<smfr> TabAtkins: opacity creates stacking context, not contaiing block
<TabAtkins> ahhhh
<TabAtkins> TabAtkins: Right, I was thinking of stacking context; i don't have a strong opinion on cb
<TabAtkins> TabAtkins: So my position is just: opacity is a filter, we need a very good reason to make filter and opacity work differently in any regard
<dbaron> github: https://github.com//issues/11
<dbaron> Perhaps it's worth reading the background in https://www.w3.org/2015/02/10-fx-minutes.html#item02 on the previous time this was resolved?
<fantasai> TabAtkins: In the linked details, roc gives an explanation for why opacity is different. It commutes with the clipping operation, whatever that means
<fantasai> TabAtkins: That doesn't apply to other filters
<fantasai> TabAtkins: tha'ts a reason for opacity to work different from other filters
<fantasai> TabAtkins: that is a reason for filters to make a containing block 'cuz awkward wherenot for opacity
<fantasai> TabAtkins: can special case root element to have filters apply to canvas
<fantasai> TabAtkins: since that's the compat issue
<fantasai> TabAtkins: and maybe also body
<myles> We are worried about web compat
<fantasai> TabAtkins: root has filter, fixedpos, and filters keep cb, then fixedpos is not fixedpos, it's abspos
<dbaron> blur then clip is different from clip then blur
<fantasai> TabAtkins: Filters create a containing block for fixedpos
<fantasai> TabAtkins: turn them into abspos
<fantasai> TabAtkins: opacity doesn't have this problem much, so doesn't need to do this
<Rossen> +1 to myles
<fantasai> TabAtkins: Are you worried aobu tmore than just filter on body?
<fantasai> myles: yes
<fantasai> TabAtkins: You get weird results, as dbaron points out
<fantasai> TabAtkins: Blur followed by clip is very different than clip then blur
<fantasai> TabAtkins: fixedpos figuring out what that menas is weird
<fantasai> TabAtkins: what do you do now?
<fantasai> myles: I don't know
<smfr> we’re kinda broken
<smfr> :)
<dbaron> I think Gecko has been shipping this for a while
<smfr> not sure if bugs or fundamental problems with implememtation
<fantasai> Rossen: fixe,d everyone expects to behave a certain way
<fantasai> Rossen: If you have a filte on a nelement you expet an effect
<fantasai> Rossen: want to trap abspos things so they filter applies to them as well
<dbaron> we did get a small number of bug reports when we shipped it, I think
<fantasai> Rossen: but for fixed, not so much
<dbaron> although at least some of them were due to bugs in what we initially shipped
<fantasai> TabAtkins: Shoudl fixedpos be blurred or not blurred?
<fantasai> Rossen: Should not be
<fantasai> TabAtkins: OK, that's an entirely diferent solution
<fantasai> tienr-ren: Does that mean fixedpos escapes stacking context?
<fantasai> ... including Opacity and CSS Mask stackign context?
<fantasai> ... Does it still follow z-index stacking order?
<fantasai> Rossen: Of course
<fantasai> TabAtkins: We already have these same cases addressed
<fantasai> TabAtkins: So we should change everything in lockstep
<TabAtkins> fantasai: The reason we did this for transforms is we need to find the staticpos
<TabAtkins> fantasai: But for filters, nothing's moving...
<TabAtkins> TabAtkins: Sure can - displacement filter
<TabAtkins> fantasai: You can have a fixpos in a scroll container, it escapes the container unless there's special trapping behavior there. Why would filters be different from that?
<fantasai> TabAtkins: but then can't apply the filter
<fantasai> fantasai: That seems reasonable
<fantasai> TabAtkins: But it's different from other things
<fantasai> fantasai: I'm not really convinced that any of these should trap fixedpos...
<fantasai> TabAtkins: yeah but that's what ppl implemented so now we're stuck with it
<fantasai> Rossen: So proposed resolution is apply both containing block for and abspos on filters as well as stacking context
<TabAtkins> Rossen: Now that we've caught up, the proposed resolution is to make filters apply a cb to abspos and fixpos
<TabAtkins> Rossen: Second is potentially add a quirk for the root containing block to not trap fixpos
<fantasai> Rossen: and other is add a quirk for root containing block, where fixed positioes remain fixed rather than turning into abspos
<fantasai> Rossen: can take in order or together
<fantasai> TabAtkins: Think we need to take them together
<fantasai> Rossen: So Filters establish stacking context as well as containing block for any positioned descendants except when they are apply to the root element, in which case they affect everthing
<dbaron> fwiw, the group already resolved to do this, it just never got edited into the spec...
<fantasai> Tien-Ren: Do we have to do this on body or just root?
<fantasai> fantasai: Please not on body, it's so terrible
<fantasai> TabAtkins: Depends on web-compat
<fantasai> Tien-Ren: describes some horrible thing that happens with style-stealing from body
<fantasai> TabAtkins: Yes, I would prefer root only if possible
<fantasai> Rossen: dbaron kindly reminds us that we resolved on all of this and we just need to edit
<TabAtkins> proposed: follow the existing resolution, add a quirk for filters on the root element to not trap fixpos
<TabAtkins> RESOLVED: follow the existing resolution, add a quirk for filters on the root element to not trap fixpos
Also, when I have an SVG filter applied to the root element which draws a green square at 100,100 using <feFlood flood-color="lime" x="100" y="100" width="100" height="100"/>, should scrolling move the square? (The solution I proposed in #11 (comment) would not move the square.)
If the root element has a transparent background, should a filter on the root element apply to the default background color? (The default background color usually gets rendered behind the root stacking context; for example, mix-blend-mode blending does not blend with the default background color.)
There, I'm trying to grayscale an entire webpage that contains a fixed positioned element. As soon as I apply the filter, it breaks the positioning (no longer allowing me to fix that element to the "Dead Center" of the page).
Shouldn't the type of filter be taking into consideration instead just assuming that all filters must sabotage fixed/absolute positioning? If a particular filter has nothing to do with size/positioning, then no descendants should be encapsulated with container-elements.
I'm very disappointed that the spec doesn't provide any granularity: all filters corrupt fix/absolute descendants, while that behavior should only be reserved for those certain filter-types that really can't work without that treatment.
A filter that only effects color, shouldn't bother descendant's position in any way!
The spec says that a filter on the HTML element does not break fixed position elements. In particular:
A value other than none for the filter property results in the creation of a containing block for absolute and fixed positioned descendants unless the element it applies to is a document root element in the current browsing context.
This behavior is implemented in at least Chromium and works correctly on this page (just tried it). This exception for the root element was made for the use case you described about fixed-position elements.
@chrishtr Those containing blocks do indeed break fixed/absolute positioned descendants and the root element exception that's working in Chromium, and not in Firefox, is not enough in my opinion.
On filters that modify color, and have no aspiration of modifying size or position, the containing blocks should not be created even if the target element is NOT root. I've submitted a separate issue here. The spec should impose the granularity of making the containing blocks conditional based on the type(s) of filters being applied and not just the non-granular all filters approach. Color related filters like grayscale and invert should not invoke the creation of containing blocks (even when applied to non-root elements).
For example, body { filter: grayscale(100%); }, should not cause the creation of containing blocks, even though the filter is being placed on body instead of :root. This should be the case on any element. #402
@chrishtr Those containing blocks do indeed break fixed/absolute positioned descendants and the root element exception that's working in Chromium, and not in Firefox, is not enough in my opinion.
The situation with Firefox (and Webkit most likely) it is just a browser bug that should be fixed.
On filters that modify color, and have no aspiration of modifying size or position, the containing blocks should not be created even if the target element is NOT root. I've submitted a separate issue here. The spec should impose the granularity of making the containing blocks conditional based on the type(s) of filters being applied and not just the non-granular all filters approach. Color related filters like grayscale and invert should not invoke the creation of containing blocks (even when applied to non-root elements).
It's not just size and position. Even filters that don't affect such things would have ill-defined behavior for non-contained elements, and make it significantly more difficult to implement hardware-accelerated rendering paths.
The only reference to this special case I see in the spec is:
A value other than none for the filter property results in the creation of a containing block for absolute and fixed positioned descendants unless the element it applies to is a document root element in the current browsing context. The list of functions are applied in the order provided.
Which is not quite only what's going on. The actual behavior is a lot more subtle, as you need to also "lift" the filters from the root element box to the viewport (minus scrollbars), so that they apply to fixed pos elements, etc.
Which is not quite only what's going on. The actual behavior is a lot more subtle, as you need to also "lift" the filters from the root element box to the viewport (minus scrollbars), so that they apply to fixed pos elements, etc.
Oh, that part. I did add that to the compositing spec in this PR.
Activity
dholbert commentedon Oct 18, 2016
CC @erikdahlstrom @dirkschulze can we get this addressed?
chrishtr commentedon Nov 2, 2016
I'm concerned that this will make it impossible to apply a filter (e.g., for accessibility to change the color) to an entire webpage without messing up fixed-position elements. This is because there is no HTML
element exposed to the developer which is the containing block for fixed-position elements.
mstange commentedon Nov 2, 2016
That is true and a bit unfortunate.
In browsers that support
backdrop-filter, you can put a fixed element on top of everything (withpointer-events: none) and apply the filter you want as that element's backdrop filter. But that's more a workaround than a true solution.A better solution would be the ability to set the filter directly on the containing block for fixe-position elements. I don't know how you would expose that.
richschwer commentedon Nov 2, 2016
I may have misunderstood your comment, but, aria-hidden only hides the container and its descendants from an AT (screen reader/screen magnifier, etc.) and it does not impact the visibility of the element or its descendants.
Rich Schwerdtfeger
----- Original message -----From: chrishtr notifications@github.comTo: w3c/fxtf-drafts fxtf-drafts@noreply.github.comCc:Subject: Re: [w3c/fxtf-drafts] filter should be defined to establish a containing block for fixed and absolutely positioned elements (#11)Date: Wed, Nov 2, 2016 1:04 PM
I'm concerned that this will make it impossible to apply a filter (e.g., for accessibility to change the color) to an entire webpage without messing up fixed-position elements. This is because there is no HTMLelement exposed to the developer which is the containing block for fixed-position elements.
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.
chrishtr commentedon Nov 14, 2016
My comment was not about aria. It was about losing the ability to provide a color or other filter extension
for web pages, without causing the page to display fixed-position elements incorrectly.
mstange commentedon Nov 14, 2016
The only other idea I have for addressing that case is: We could make
filteron the root element special, similar to what we do foroverflowandbackground, and make it always propagate up to the containing block for position:fixed elements.bzbarsky commentedon Apr 3, 2017
@dirkschulze @erikdahlstrom any chance of this spec getting updated per the resolution mentioned above?
chrishtr commentedon Apr 4, 2017
If there is consensus, I'd like to try to make this change in Chrome.
bzbarsky commentedon Apr 5, 2017
Note that Firefox has been shipping this behavior for a while now, as I understand, since that was what the working group resolved...
Add a use-counter for viewport-fixed position:fixed under a filter
Add a use-counter for viewport-fixed position:fixed under a filter
css-meeting-bot commentedon Nov 8, 2017
The Working Group just discussed
Filter effects - filters should establish containing blocks for abspos and fixpos, and agreed to the following resolutions:RESOLVED: follow the existing resolution, add a quirk for filters on the root element to not trap fixposThe full IRC log of that discussion
<TabAtkins> Topic: Filter effects - filters should establish containing blocks for abspos and fixpos<TabAtkins> TabAtkins: Filters are morally equivalent to opacity (or vice versa) and opacity establishes a cb, so what's wrong?
<TabAtkins> ericwilligers: People were using extensions to apply a filter ot the whole page, and they didn't want things to rearrange
<TabAtkins> TabAtkins: Ah, it would break fixpos in that case.
<smfr> TabAtkins: opacity creates stacking context, not contaiing block
<TabAtkins> ahhhh
<TabAtkins> TabAtkins: Right, I was thinking of stacking context; i don't have a strong opinion on cb
<TabAtkins> TabAtkins: So my position is just: opacity is a filter, we need a very good reason to make filter and opacity work differently in any regard
<dbaron> github: https://github.com//issues/11
<dbaron> Perhaps it's worth reading the background in https://www.w3.org/2015/02/10-fx-minutes.html#item02 on the previous time this was resolved?
<fantasai> TabAtkins: In the linked details, roc gives an explanation for why opacity is different. It commutes with the clipping operation, whatever that means
<fantasai> TabAtkins: That doesn't apply to other filters
<fantasai> TabAtkins: tha'ts a reason for opacity to work different from other filters
<fantasai> TabAtkins: that is a reason for filters to make a containing block 'cuz awkward wherenot for opacity
<fantasai> TabAtkins: can special case root element to have filters apply to canvas
<fantasai> TabAtkins: since that's the compat issue
<fantasai> TabAtkins: and maybe also body
<myles> We are worried about web compat
<fantasai> TabAtkins: root has filter, fixedpos, and filters keep cb, then fixedpos is not fixedpos, it's abspos
<dbaron> blur then clip is different from clip then blur
<fantasai> TabAtkins: Filters create a containing block for fixedpos
<fantasai> TabAtkins: turn them into abspos
<fantasai> TabAtkins: opacity doesn't have this problem much, so doesn't need to do this
<Rossen> +1 to myles
<fantasai> TabAtkins: Are you worried aobu tmore than just filter on body?
<fantasai> myles: yes
<fantasai> TabAtkins: You get weird results, as dbaron points out
<fantasai> TabAtkins: Blur followed by clip is very different than clip then blur
<fantasai> TabAtkins: fixedpos figuring out what that menas is weird
<fantasai> TabAtkins: what do you do now?
<fantasai> myles: I don't know
<smfr> we’re kinda broken
<smfr> :)
<dbaron> I think Gecko has been shipping this for a while
<smfr> not sure if bugs or fundamental problems with implememtation
<fantasai> Rossen: fixe,d everyone expects to behave a certain way
<fantasai> Rossen: If you have a filte on a nelement you expet an effect
<fantasai> Rossen: want to trap abspos things so they filter applies to them as well
<dbaron> we did get a small number of bug reports when we shipped it, I think
<fantasai> Rossen: but for fixed, not so much
<dbaron> although at least some of them were due to bugs in what we initially shipped
<fantasai> TabAtkins: Shoudl fixedpos be blurred or not blurred?
<fantasai> Rossen: Should not be
<fantasai> TabAtkins: OK, that's an entirely diferent solution
<fantasai> tienr-ren: Does that mean fixedpos escapes stacking context?
<fantasai> ... including Opacity and CSS Mask stackign context?
<fantasai> ... Does it still follow z-index stacking order?
<fantasai> Rossen: Of course
<fantasai> TabAtkins: We already have these same cases addressed
<fantasai> TabAtkins: So we should change everything in lockstep
<TabAtkins> fantasai: The reason we did this for transforms is we need to find the staticpos
<TabAtkins> fantasai: But for filters, nothing's moving...
<TabAtkins> TabAtkins: Sure can - displacement filter
<TabAtkins> fantasai: You can have a fixpos in a scroll container, it escapes the container unless there's special trapping behavior there. Why would filters be different from that?
<fantasai> TabAtkins: but then can't apply the filter
<fantasai> fantasai: That seems reasonable
<fantasai> TabAtkins: But it's different from other things
<fantasai> fantasai: I'm not really convinced that any of these should trap fixedpos...
<fantasai> TabAtkins: yeah but that's what ppl implemented so now we're stuck with it
<fantasai> Rossen: So proposed resolution is apply both containing block for and abspos on filters as well as stacking context
<TabAtkins> Rossen: Now that we've caught up, the proposed resolution is to make filters apply a cb to abspos and fixpos
<TabAtkins> Rossen: Second is potentially add a quirk for the root containing block to not trap fixpos
<fantasai> Rossen: and other is add a quirk for root containing block, where fixed positioes remain fixed rather than turning into abspos
<fantasai> Rossen: can take in order or together
<fantasai> TabAtkins: Think we need to take them together
<fantasai> Rossen: So Filters establish stacking context as well as containing block for any positioned descendants except when they are apply to the root element, in which case they affect everthing
<dbaron> fwiw, the group already resolved to do this, it just never got edited into the spec...
<fantasai> Tien-Ren: Do we have to do this on body or just root?
<fantasai> fantasai: Please not on body, it's so terrible
<fantasai> TabAtkins: Depends on web-compat
<fantasai> Tien-Ren: describes some horrible thing that happens with style-stealing from body
<fantasai> TabAtkins: Yes, I would prefer root only if possible
<fantasai> Rossen: dbaron kindly reminds us that we resolved on all of this and we just need to edit
<TabAtkins> proposed: follow the existing resolution, add a quirk for filters on the root element to not trap fixpos
<TabAtkins> RESOLVED: follow the existing resolution, add a quirk for filters on the root element to not trap fixpos
mstange commentedon Nov 8, 2017
@dbaron, can you clarify the resolution? If you set a blur filter on the root element, should fixpos elements be blurred?
mstange commentedon Nov 8, 2017
Also, when I have an SVG filter applied to the root element which draws a green square at 100,100 using
<feFlood flood-color="lime" x="100" y="100" width="100" height="100"/>, should scrolling move the square? (The solution I proposed in #11 (comment) would not move the square.)If the root element has a transparent background, should a filter on the root element apply to the default background color? (The default background color usually gets rendered behind the root stacking context; for example,
mix-blend-modeblending does not blend with the default background color.)43 remaining items
astearns commentedon Aug 14, 2018
@chrishtr to save some time, could you add a comment here summarizing what you want the working group to resolve on?
atanassov commentedon Aug 20, 2018
The issue is not ready for CSSWG discussion since we're waiting for use cases (as discussed on last call, see minutes above).
chrishtr commentedon Sep 6, 2018
I'm going to close this issue in favor of #282. Going to post a complete proposed solution to all issues on that issue.
Revert obsolete use counter.
Lonniebiz commentedon Jul 4, 2020
The spec need to make exception for filters that have nothing to do with size or positioning (color-based filters for example).
If I want to grayscale the entire page, why should that have any effect on absolute/fixed positioned descendants?
Take a look at this example:
https://stackoverflow.com/questions/62717289/
There, I'm trying to grayscale an entire webpage that contains a fixed positioned element. As soon as I apply the filter, it breaks the positioning (no longer allowing me to fix that element to the "Dead Center" of the page).
Shouldn't the type of filter be taking into consideration instead just assuming that all filters must sabotage fixed/absolute positioning? If a particular filter has nothing to do with size/positioning, then no descendants should be encapsulated with container-elements.
I'm very disappointed that the spec doesn't provide any granularity: all filters corrupt fix/absolute descendants, while that behavior should only be reserved for those certain filter-types that really can't work without that treatment.
A filter that only effects color, shouldn't bother descendant's position in any way!
chrishtr commentedon Jul 5, 2020
The spec says that a filter on the HTML element does not break fixed position elements. In particular:
A value other than none for the filter property results in the creation of a containing block for absolute and fixed positioned descendants unless the element it applies to is a document root element in the current browsing context.This behavior is implemented in at least Chromium and works correctly on this page (just tried it). This exception for the root element was made for the use case you described about fixed-position elements.
Lonniebiz commentedon Jul 5, 2020
@chrishtr Those containing blocks do indeed break fixed/absolute positioned descendants and the root element exception that's working in Chromium, and not in Firefox, is not enough in my opinion.
On filters that modify color, and have no aspiration of modifying size or position, the containing blocks should not be created even if the target element is NOT root. I've submitted a separate issue here. The spec should impose the granularity of making the containing blocks conditional based on the type(s) of filters being applied and not just the non-granular all filters approach. Color related filters like
grayscaleandinvertshould not invoke the creation of containing blocks (even when applied to non-root elements).For example,
body { filter: grayscale(100%); }, should not cause the creation of containing blocks, even though the filter is being placed onbodyinstead of:root. This should be the case on any element. #402chrishtr commentedon Jul 5, 2020
The situation with Firefox (and Webkit most likely) it is just a browser bug that should be fixed.
It's not just size and position. Even filters that don't affect such things would have ill-defined behavior for non-contained elements, and make it significantly more difficult to implement hardware-accelerated rendering paths.
emilio commentedon Aug 26, 2020
We should update the spec to reflect #11 (comment) I suspect. Blink and WebKit do filter the whole viewport.
chrishtr commentedon Aug 26, 2020
@emilio: Do you mean the comment about the containing block thing not apply to the root element?
emilio commentedon Aug 26, 2020
The only reference to this special case I see in the spec is:
Which is not quite only what's going on. The actual behavior is a lot more subtle, as you need to also "lift" the filters from the root element box to the viewport (minus scrollbars), so that they apply to fixed pos elements, etc.
chrishtr commentedon Aug 26, 2020
Oh, that part. I did add that to the compositing spec in this PR.