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

Web fonts (@font-face) cannot be loaded from within the Web Component #46

Open
mbeckem opened this issue May 26, 2023 · 0 comments
Open

Comments

@mbeckem
Copy link
Contributor

mbeckem commented May 26, 2023

It appears that browser simply ignore @font-face declarations within the web component's shadow dom.

Stylesheets that rely on the presence of certain web fonts (e.g. icon fonts) will therefore not work by default, since the web fonts are not downloaded at all.

Idea for an workaround:

  • Inject minimal css to load the font faces in the outer site's document head. This is technically a violation of encapsulation but there does not seem to be a better way at the moment
  • The bulk of the css should still be in within the web component

See also

@mbeckem mbeckem transferred this issue from open-pioneer/trails-starter Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant