Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
How to use react-shadow with chrome extension?

I'm developing a chrome extension using React. I am using vanilla.js for background and content script. I want to implement a shadow-dom element like Grammarly do in textbox of web pages. Refer this pic: see the bottom right corner of the gif

Anyone has any idea how Grammarly achieve this functionality? any exact code segment from grammarly? I've tried attaching shadow elements into the content script, but the results aren''t satisfactory. Here is the code I tried:

var host = document.activeElement;
var root = host.attachShadow({mode: 'open'});
var div = document.createElement('div');
div.className = 'div';
div.innerHTML = '<style>.div{position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0);}</style>this is shadow dom';
root.appendChild(div);

Then I tried the react-shadow package. But I couldn't get the element into the web page. So how to display this dynamic element in the exact same place of the textboxes as grammarly do?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!