Issue #3561💬 AnsweredOpened June 23, 2021by AStoker0 reactions

Enhanced Shadow DOM Support

Quick answerby artf

Hi @AStoker I don't understand what is the real issue with your example (aside not loading GrapesJS styles inside your shadow dom). If you're attaching shadow dom, obviously, you can't do this container: '#gjs', but you're still able to pass HTMLElements as you're already doing in your example, so what is the issue?

Read full answer below ↓

Question

What are you trying to add to GrapesJS? Better Shadow DOM support, allowing developers to render GrapesJS inside a Shadow element without having to specifically pass in elements rather than selectors in the configuration. Describe your feature request detailed When currently using element selectors, GrapesJS simply uses the document query selector. This does not work when rendering inside a Shadow DOM, as the document isn't the shadow root. I would like to be able to define a shadow root so that anything GrapesJS does/needs is contained within the shadow root. Example of using GrapesJS inside...

Answers (4)

artfJune 24, 2021

Hi @AStoker I don't understand what is the real issue with your example (aside not loading GrapesJS styles inside your shadow dom). If you're attaching shadow dom, obviously, you can't do this container: '#gjs', but you're still able to pass HTMLElements as you're already doing in your example, so...

AStokerJune 24, 2021

The issue is that I must pass HTML elements everywhere and cannot use selectors. This can become cumbersome to write as I must now use the shadow Dom's query selector for every panel, every element, anything that we hook into GrapesJS. Additionally, if there were the concept of a container, it woul...

AStokerJune 24, 2021

I updated the JSFiddle so you can see what we need to do to get styles within Shadow DOM. But unfortunately the CSS that's automatically added by GrapesJS exists on the body and is both polluting the global stylesheets and pointless due to GrapesJS being inside the Shadow DOM.

GJSBlockMay 17, 2026

Thanks for reporting this, @AStoker. Great suggestion about FEAT: Enhanced Shadow DOM Support! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior. Using the event system: Alternative approaches: Listen to selector:add for CSS selector changes U...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.