Extension is adopting the font of the website I go to

53 views
Skip to first unread message

Rory

unread,
Jun 8, 2021, 6:25:24 PM6/8/21
to Chromium Extensions
I am using a shadowroot to prevent the extension widget from adopting the stylesheet of the underlying website it opens over, however, it seems that certain elements of the website are leaking in.

I noticed today that whatever the main font of a website is appears to be replacing the font in my widget.

Does anyone know what might be causing this and how to prevent it?

Rory

unread,
Jun 8, 2021, 7:37:55 PM6/8/21
to Chromium Extensions, Rory
Nevermind, found the solution. I had removed the body tag by accident from my widget so it was inheriting the body attributes of whatever the underlying site was.

wOxxOm

unread,
Jun 9, 2021, 10:09:21 AM6/9/21
to Chromium Extensions, Rory
You can also sever the inheritance explicitly by adding CSS on the shadow root

:host { all: initial }

Rory

unread,
Jun 9, 2021, 1:29:24 PM6/9/21
to Chromium Extensions, wOxxOm, Rory
Thanks w0xx0m, very useful to know.
Reply all
Reply to author
Forward
0 new messages