Skip to content

Trouble Loading Custom Font Into Shadow DOM in my Chrome Extension #139

@lancesnider

Description

@lancesnider

I'm having trouble loading my custom font into my Chrome Extension.

// index.js
<root.div>
  <style dangerouslySetInnerHTML={{ __html: stylesheet }} />
  <App />
</root.div>
@font-face {
    font-family: 'defaultText';
    src: url('chrome-extension://' + $extensionId + '/Inter-Regular.woff2')
        format('woff2'),
      url('chrome-extension://' + $extensionId + '/Inter-Regular.woff')
        format('woff');
  }

.some-class {
  // I set the fallback font to serif so it's easy to catch
  font-family: 'defaultText', serif;
}

Here's the style tag that gets put inside my shadow. I've tested those urls and the font is there.

Screen Shot 2022-08-31 at 11 47 57 AM

If I change <root.div> to <div> the fonts load properly.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions