Skip to content
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

@font-face and @property constructs in Shadow Roots #212

Closed
Westbrook opened this issue Oct 12, 2022 · 13 comments
Closed

@font-face and @property constructs in Shadow Roots #212

Westbrook opened this issue Oct 12, 2022 · 13 comments
Labels
focus-area-proposal Focus Area Proposal

Comments

@Westbrook
Copy link

Westbrook commented Oct 12, 2022

Description

Whether it is @font-face or @property, an intersection of confusing spec'ing and partial implementation leaves a number of nice capabilities out of reach of shadow root users. Placing @font-face or @property within shadow roots is ignored in some browsers degrading the experience of pre-packaged web components cross browser. This is an area where WPT could also be leveraged to support not falling into this same trap with other and future @ sigil based CSS APIs.

@font-face

@Property

Rationale

The code needed to packages a custom element for reuse should be usage within the custom element package.

Specification

w3c/csswg-drafts#1995

Tests

No response

@Westbrook Westbrook added the focus-area-proposal Focus Area Proposal label Oct 12, 2022
@foolip foolip moved this to Proposed in Interop 2023 Oct 13, 2022
@gsnedders
Copy link
Member

Whether is @font-face or @Property an intersection of confusing spec'ing and partial implementation leaves a number of nice capabilities out of reach of shadow root users.

I can't understand what this means?

@Westbrook
Copy link
Author

@gsnedders here's a demo to, hopefully, clarify: https://codepen.io/nolanlawson-the-selector/pen/MWVeLVV As you see, while the component is attempting to fully encapsulate everything about delivering it, including the fonts to use, this process only works in Safari at current. Other browsers ignore the @font-face rule within the shadow root and fail to deliver bolded text:

Fail state:
image

Pass state:
image

Other APIs managed with the @ sigil seem to experience the same issue, e.g. @property (at least in Chrome where it is currently implemented), and it while it's not something that could be part of "Interop 2023" the idea that there was some test driven process whereby we could ensure that what is an exciting crop of future @ sigil based APIs (e.g. @position-fallback) do not suffer this same situation.

@gsnedders

This comment was marked as outdated.

@foolip foolip mentioned this issue Oct 19, 2022
@gsnedders
Copy link
Member

Specification

https://drafts.csswg.org/css-scoping/#shadow-names

I think?

@gsnedders
Copy link
Member

And while not one of the at-rules mentioned, these tests cover @keyframes.

One could probably make some largely derivative tests of those for @font-face, which I believe is the only other at-rule which defines a global name supported cross-browser.

@gsnedders
Copy link
Member

And to be explicit: I think we should consider this proposal to cover "at-rules that define global names", rather than specifically @font-face and @property. There's value in fixing the rest of this even without #158 (@property).

@foolip
Copy link
Member

foolip commented Oct 28, 2022

@gsnedders can you work with @Westbrook to update the issue description if you want to expand the focus?

@gsnedders
Copy link
Member

To be clear, I think we should just test the at-rules that define global names which are supported; I don't think we should require every browser to implement @property (or @color-profile, etc.) as part of this.

@emilio
Copy link

emilio commented Nov 3, 2022

Did everyone agree in a consistent model for this? @keyframe sorta-kinda-works in a sorta-kinda-interoperable way, but it's a mess, and definitely not something we can do for @font-face.

@emilio
Copy link

emilio commented Nov 3, 2022

Ah current spec text is https://drafts.csswg.org/css-scoping/#shadow-names which is mentioned above indeed. In general, fixing this up is sensible, and the spec seems reasonable.

@foolip
Copy link
Member

foolip commented Jan 30, 2023

https://drafts.csswg.org/css-scoping/#shadow-names doesn't mention @property so I went to look for the spec for this. I found https://drafts.css-houdini.org/css-properties-values-api/#at-property-rule which says:

A @property is invalid if it occurs in a stylesheet inside of a shadow tree, and must be ignored.

I suspect that makes https://bugs.chromium.org/p/chromium/issues/detail?id=1231135 invalid, but I've asked to confirm.

@nairnandu
Copy link
Contributor

Thank you for proposing @font-face and @property in shadow trees for inclusion in Interop 2023.

We wanted to let you know that this proposal was not selected to be part of Interop this year. We had many strong proposals, and could not accept them all. As discussed in the issue comments, we could not find any tests for @font-face or @property in shadow trees. We would welcome this proposal being resubmitted for a future round of Interop once there are tests covering the behavior.

For an overview of our process, see the proposal selection summary. Thank you again for contributing to Interop 2023!

Posted on behalf of the Interop team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus-area-proposal Focus Area Proposal
Projects
No open projects
Status: Proposed
Development

No branches or pull requests

5 participants