You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The UI of the content script that is injected is inconsistent depending on the page it is injected into.
For instance, the UI appears smaller when you visit stackoverflow.com but looks bigger on others.
Shadow DOM doesn't fully encapsulate the styling. Upon further investigation, it appears that CSS frameworks such as unocss uses relative font-sizing (e.g rem, em, etc) and this causes problems in the styling of the elements under Shadow DOM.
The reason is that rem is relative to the html element of the current page and not to the shadow root, and thus unocss css classes are resized based on what is set as the root font size on the html element of the current page.
It's been a while since i've worked on browser extensions and shadow dom, but AFAIK you can get around this by injecting a style on the shadow root itself. Read more about this topic on this post.
OTOH, we must also know the distinction between shadow host and shadow root.
If you're simply trying to style the wrapper element that contains the entire Shadow Tree, then we may style it using :host selector.
Describe the bug
The UI of the content script that is injected is inconsistent depending on the page it is injected into.
For instance, the UI appears smaller when you visit stackoverflow.com but looks bigger on others.
Shadow DOM doesn't fully encapsulate the styling. Upon further investigation, it appears that CSS frameworks such as unocss uses relative font-sizing (e.g
rem
,em
, etc) and this causes problems in the styling of the elements under Shadow DOM.The reason is that
rem
is relative to thehtml
element of the current page and not to the shadow root, and thus unocss css classes are resized based on what is set as the root font size on thehtml
element of the current page.Reproduction
replicable on main branch
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: