-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to customize the style of a dialog's ::backdrop residing inside a Shadow DOM. #124
Comments
Have you tried without CSS |
Yes. CSS variables are propagated via inheritance into descendants, so if a pseudo-element doesn't inherit from anything, CSS variables which are not defined for the pseudo-element directly would have no effect on the pseudo-element. |
and
appear to render expected result at Chromium. |
@guest271314: True, that seems to work, but it still does not solve the issue of the 2nd minimal repro, which involves Shadow DOM. |
Have not tried Polymer. Can the code be composed without using a library? |
Here is a simple example that puts a |
You can include
|
@guest271314: Thanks for your effort to help find a workaround. Having said that, this bug is claiming that there is no proper (for example without using JS) way to style a Your workaround shows that one can programatically create a |
"without using JS" does not appear at OP? Not sure what you mean by "impossible", or how the linked document is related to the HTML standard? What exactly is the the requirement? |
You can use the appropriate |
HTML
JavaScript
|
Can you clarify the parameters of
? |
Really need @tabatkins and @fantasai's expertise to figure out what the right model for And the other thing we need to know is that if we make it inherit, what would break... |
I wonder why was it made not inherit anything? If there isn't really any compelling reason, I guess we should probably just have it inherit from the element. |
There wasn't a compelling reason. As I said in the other issue it was to address https://lists.w3.org/Archives/Public/www-style/2012Jun/0441.html and back then we didn't have CSS variables. You don't think there's any observable effects to doing this? I guess most inheriting properties won't have an effect on |
OK. I guess that means we can make it inherit from the originating element.
So, by default, that shouldn't affect anything. The only properties directly affect It indeed can have observable effects if authors want to, for example, they can say |
How an element/pseudo-element is rendered has no effect on where it inherits from. It's only a question of where is the element/pseudo-element logically located in the DOM tree. e.g., In the |
@upsuper From the expected effect perspective the only logical element that can fathom which |
What about |
The result of the |
Think of Web components (aka custom elements). An element that wraps a As a developer, a custom element is thought of as a black box with a public API. Having to treat the |
What is the issue with the code at the link? |
@guest271314: I've tried to explain the issue multiple times. See minimal repro 2 at the start of this bug. |
Is it not possible to reproduce the result at Firefox? |
AFAIK |
We should just say that ::backdrop inherits custom properties from its originating element, even if we explicitly block all other inheritance. (This should be doable in pure CSS by saying that |
I don't think it makes much sense to distinguish between variables and other properties. That may add implementation complexity for no good reason. |
Polymer is not currently being loaded at linked jsfiddle. Can the complete issue be reproduced without using a library? |
A workaround which gets the style properties of host element from
|
This is as a result of a spec change (see link in the test), but it addresses a very long-standing issue with this pseudo-element, see whatwg/fullscreen#124. Differential Revision: https://phabricator.services.mozilla.com/D189484 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1855668 gecko-commit: e886c398d906f9113a4ccfaba65dd10bad77f0cb gecko-reviewers: zrhoffman
…=zrhoffman This is as a result of a spec change (see link in the test), but it addresses a very long-standing issue with this pseudo-element, see whatwg/fullscreen#124. Differential Revision: https://phabricator.services.mozilla.com/D189484
This is as a result of a spec change (see link in the test), but it addresses a very long-standing issue with this pseudo-element, see whatwg/fullscreen#124. Differential Revision: https://phabricator.services.mozilla.com/D189484 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1855668 gecko-commit: e886c398d906f9113a4ccfaba65dd10bad77f0cb gecko-reviewers: zrhoffman
…=zrhoffman This is as a result of a spec change (see link in the test), but it addresses a very long-standing issue with this pseudo-element, see whatwg/fullscreen#124. Differential Revision: https://phabricator.services.mozilla.com/D189484
Seems like this is tracked in chromium with https://bugs.chromium.org/p/chromium/issues/detail?id=827397 (I tested in chrome with the Anyone know if there is a webkit bug for this? I couldn't find one. Update: I created https://bugs.webkit.org/show_bug.cgi?id=263834 |
https://bugs.webkit.org/show_bug.cgi?id=263834 Reviewed by Tim Nguyen. StyleTreeResolver/RenterTreeUpdate explicitly checked for ::backdrop elements to remove their inheritance chain, per the spec at the time. whatwg/fullscreen#124 was created to query this and it was resolved that ::backdrop _should_ inherit. This commit addresses the change by removing the check in StyleTreeResolve to allow ::backdrop to inherit from its parent element, and altering the check in RenderTreeUpdate to call renderer.style() instead of renderer.view.style(). This aligns behaviour with the other browsers and WPT. * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/dialog-backdrop-create.html: * Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updateBackdropRenderer): * Source/WebCore/style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::makeResolutionContextForPseudoElement): Canonical link: https://commits.webkit.org/270246@main
https://bugs.webkit.org/show_bug.cgi?id=263834 is now resolved. Is it worth closing this issue out now? |
@keithamus from that PR it seems like the only coverage for this is |
Right of course good point. |
I'm adding a test for this in web-platform-tests/wpt#43445. |
This is as a result of a spec change (see link in the test), but it addresses a very long-standing issue with this pseudo-element, see whatwg/fullscreen#124. Differential Revision: https://phabricator.services.mozilla.com/D189484 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1855668 gecko-commit: e886c398d906f9113a4ccfaba65dd10bad77f0cb gecko-reviewers: zrhoffman
Glad to see Chrome will be shipping soon as well: https://groups.google.com/a/chromium.org/g/blink-dev/c/yXTxBfLthzc |
… ::backdrop, a=testonly Automatic update from web-platform-tests Test custom properties with fullscreen's ::backdrop (#43445) Fixes whatwg/fullscreen#124. -- wpt-commits: 6ee66f924120d02ae697a5c4c2999f27dd5ad5c0 wpt-pr: 43445
… ::backdrop, a=testonly Automatic update from web-platform-tests Test custom properties with fullscreen's ::backdrop (#43445) Fixes whatwg/fullscreen#124. -- wpt-commits: 6ee66f924120d02ae697a5c4c2999f27dd5ad5c0 wpt-pr: 43445 UltraBlame original commit: 5ef50e3d812feaa82c780fd762360b5045d45353
… ::backdrop, a=testonly Automatic update from web-platform-tests Test custom properties with fullscreen's ::backdrop (#43445) Fixes whatwg/fullscreen#124. -- wpt-commits: 6ee66f924120d02ae697a5c4c2999f27dd5ad5c0 wpt-pr: 43445 UltraBlame original commit: 5ef50e3d812feaa82c780fd762360b5045d45353
… ::backdrop, a=testonly Automatic update from web-platform-tests Test custom properties with fullscreen's ::backdrop (#43445) Fixes whatwg/fullscreen#124. -- wpt-commits: 6ee66f924120d02ae697a5c4c2999f27dd5ad5c0 wpt-pr: 43445 UltraBlame original commit: 5ef50e3d812feaa82c780fd762360b5045d45353
… ::backdrop, a=testonly Automatic update from web-platform-tests Test custom properties with fullscreen's ::backdrop (#43445) Fixes whatwg/fullscreen#124. -- wpt-commits: 6ee66f924120d02ae697a5c4c2999f27dd5ad5c0 wpt-pr: 43445
…=zrhoffman This is as a result of a spec change (see link in the test), but it addresses a very long-standing issue with this pseudo-element, see whatwg/fullscreen#124. Differential Revision: https://phabricator.services.mozilla.com/D189484
Note: Copied from whatwg/html#3601. Please continue discussion here.
More context at https://bugs.chromium.org/p/chromium/issues/detail?id=827397.
Minimal repro 1
This just showcases that any CSS variable is ignored from ::backdrop elements, even without Shadow DOM usage.
https://jsfiddle.net/1zevfdce/3/
Minimal repro 2
Showcases the problem when a
<dialog>
resides inside a Shadow DOM.https://jsfiddle.net/o1trLoqL/2/
Note that the spec mentions the following
"It does not inherit from any element and is not inherited from. No restrictions are made on what properties apply to this pseudo-element either."
Is that the reason for the current behavior? If yes, should the spec be revised, such that customizing the style of a ::backdrop element is possible even if it resides inside a Shadow DOM? Or is there already a viable workaround?
cc @annevk @foolip @domenic @TakayoshiKochi
The text was updated successfully, but these errors were encountered: