PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
8.84k stars 315 forks source link

[BUG] Content script overlay UI appears smaller on some pages #1007

Open lucky-bai opened 2 weeks ago

lucky-bai commented 2 weeks ago

What happened?

I am experiencing a bug with the content script UI that causes it to appear smaller than intended on some pages, notably linkedin.com. Steps to reproduce:

  1. In the examples/with-content-scripts-ui, make the plasmo-overlay.tsx inject into all URLs.
  2. Then navigate to LinkedIn.com (any page).

Expected: On most pages (eg: gmail), it looks like this:

AGAZnRo3FHTEjsurBToo3xXnD5pli_5v3AvLk6uhFQu4idsvEXmD03xI1JGUrL8ruegVjbe2FfK8qkMTGg2YVQhHkkWFaZwQoWGpa7Ew9HSKlJ9pciACvTfYSxHOWMnog1lopTs0NSXTL39Ntf9966-KWcGagXFKrE2uy9LHzVFfM0WbWj75TlCjmcH8Z5dP_FnE8C4_0f9bcewlQ0QWLzBy

However, on LinkedIn, it appears smaller:

AGAZnRq4260xl2ZjlrWUbXm0vM55Qr7XlHcsjLmPOlnqiUGPVrJsanpZRL7uFJ626B92otJ28BE4yBlfM59ZyFvYZ0flWr1uQjT7FpOj1KT2GEkDDnKE7V4s3PPVb7TNjZLTGrhE4uG02-eW0AXnRCT1YsukOyS_jz6Ezuv6TXm_kW2z8ciSNUup-A6xcrrNAjKjN-okciaZOdzicKrNRCuz

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contribution

Code of Conduct

fran-veiras commented 1 week ago

did you find any solution? I have the same bug...

naan commented 6 days ago

I had a similar problem where it appears bigger on some pages and it was caused by Root Container Style from the website. The issue is described here: https://docs.plasmo.com/framework/content-scripts-ui/styling#root-container-style

To avoid this, I ended up inserting <iframe> instead of <div> for all of my CSUI, something like the following:

import Frame from "react-frame-component"

export default MyCSUI({content}) {
    ...
    return (
        <Frame>
        <div>
           {content}
        </div>
        </Frame>
    )
}

I don't know what other way to workaround this. The document says override some CSS property with !important but it didn't work if the root container style sets something like font-size.