Modal won't open after closing it dynamically
I can't reproduce it on the official demo, eg. But just checking your code I'd say it doesn't open because you're closing it immediately after (just after the open is triggered), am I missing something?!
Read full answer below βQuestion
Hello;
Thank you guys for the great tool, I just love the documentation, the easy to use/understand. I think I ran into an issue with the modal not opening again after closing it dynamically the first time. example:
editor.on('modal:open', () => this.openModalHandler(editor));
openModalHandler(editor){
const model = editor.getSelected();
const modal = editor.Modal;
const {type} = model.attributes;
modal.close();
switch (type) {
case 'image':
case 'section':
return this.addBackgroundImage(type);
}
}
Answers (3)
I can't reproduce it on the official demo, eg.
editor.on('modal:open', () => {
console.log('Modal opened');
setTimeout(() => {
console.log('Close modal');
editor.Modal.close()
}, 2000)
});
But just checking your code I'd say it doesn't open because you're closing it immediately after (just after the open is triggered), am I missing something?!
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
Thanks for reporting this, @alivex.
Thanks for sharing your report about Modal won't open after closing it dynamically. To help the team investigate and prioritize this:
Please provide:
- A minimal reproducible example (CodeSandbox/JSFiddle)
- Your GrapesJS version number
- Browser and OS information
- Any error messages from the browser console
- Steps to reproduce the issue
What helps most:
- Minimal code example (not your full project)
- Screen recording or screenshot showing the issue
- Expected vs actual behavior clearly stated
- GrapesJS configuration you're using
With these details, the maintainers can identify and prioritize a fix much faster. The GrapesJS team is very responsive to well-documented issues.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3336
Single click text edit
There are lots of click required to make text editable, can we make text field editable on a single Click. I know, Single click can get ann...
Issue #4559
RTE actions are not working after the first time
Hi..!, the RTE actions are not working after the first time , when we try to apply the action on previous applied element its not working I...
Issue #3347
How can I get Uncompressed JS code for me to edit?
Hi, thank you for reviewing my problem. I want to use my own JSEditor to edit htmlγcss and js. 1γFirst, I use getHtml, getCss, getJs to dis...
Issue #3541
[QUESTION] What is the idiomatic way to append and remove classes from components?
Hey there π Love the editor! We're using traits to modify what classes a component has, but that feels a bit hacky as you have to redeclar...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins β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.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
GrapesJS vs Webflow vs Builder.io vs Puck: Which Visual Builder to Choose in 2026
A practitioner's 2026 comparison of GrapesJS, Webflow, Builder.io, and Puck β pricing, AI features, lock-in, and a one-line rule for picking the right one
Tutorial
GrapesJS vs Webflow vs Tilda (2026): Honest Comparison, Pricing & Which to Pick
GrapesJS vs Webflow vs Tilda compared head-to-head: real 2026 pricing, SEO features, code export, and which one actually fits your project
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.