Skip to content

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

Closed

Description

@Westbrook

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

Activity

  1. moved this to Proposed in Interop 2023on Oct 13, 2022
  2. gsnedders commented on Oct 14, 2022

    @gsnedders
    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?

  3. Westbrook commented on Oct 15, 2022

    @Westbrook
    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.

  4. gsnedders commented on Oct 15, 2022

    @gsnedders
  5. gsnedders commented on Oct 25, 2022

    @gsnedders
    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.

  6. gsnedders commented on Oct 28, 2022

    @gsnedders
    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).

  7. foolip commented on Oct 28, 2022

    @foolip
    Member

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

  8. gsnedders commented on Oct 28, 2022

    @gsnedders
    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.

  9. emilio commented on Nov 3, 2022

    @emilio

    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.

  10. emilio commented on Nov 3, 2022

    @emilio

    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.

  11. foolip commented on Jan 30, 2023

    @foolip
    Member
  12. nairnandu commented on Feb 1, 2023

    @nairnandu
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus-area-proposal

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions