Flex Property not working in style manager
I diagnosed the issue after finding the same problem independently. Looking at StyleManager.select() https://github.com/artf/grapesjs/blob/75cd582a8d1a91096276bc4dccc7475a269ad45c/src/style_manager/index.js#L339-L395 On line 369, every property is looped through to check its visibility for the new target. However the...
Read full answer below ↓Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Version 1.34.81 Chromium: 97.0.4692.99 (Official Build) (64-bit)
Reproducible demo link
https://codesandbox.io/s/strange-sun-qgdcq?file=/index.js
Describe the bug

How to reproduce the bug?
- create custom type component
- drop the component in canvas
- set the display property to flex in style manager.
What is the expected behavior? Should show flex properties when the display(general property) is flex
What is the current behavior? Not showing flex properties
It is necessary to execute some code in order to reproduce the bug, paste it here below:
// your code here
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (4)
I diagnosed the issue after finding the same problem independently.
Looking at StyleManager.select()
On line 369, every property is looped through to check its visibility for the new target.
However the __checkVisibility function does not access the current value by looking at the target's styles. Instead it looks for the current value stored in the property model. (source)
The problem is that __checkVisibility is being called before the property model hasn't been told a new target has been selected, as that does not happen until line 392. So the value being checked is not from the target we just selected.
@Vac1911 @artf I got it, but what's the solution, how can I fix this problem? is this grapejs issue or mine?
@saudAtIrisdame It seems to be a grapejs issue. I fixed it for myself changing the source code, reordering the select method to check visibility last.
Here is the dist file after running build:js
https://gist.github.com/Vac1911/4c89f2a48809bee5fefd2d21525d37ad
select(target, opts = {}) {
const { em } = this;
const trgs = isArray(target) ? target : [target];
const { stylable } = opts;
const cssc = em.get("CssComposer");
let targets = [];
trgs.filter(Boolean).forEach((target) => {
let model = target;
if (isString(target)) {
const rule = cssc.getRule(target) || cssc.setRule(target);
!isUndefined(stylable) && rule.set({ stylable });
model = rule;
}
targets.push(model);
});
const component =
opts.component || targets.filter((t) => isComponent(t)).reverse()[0];
targets = targets.map((t) => this.getModelToStyle(t));
const state = em.getState();
const lastTarget = targets.slice().reverse()[0];
const lastTargetParents = this.getParentRules(lastTarget, {
state,
component,
});
let stateTarget = this.__getStateTarget();
// Handle the creation and update of the state rule, if enabled.
em.skip(() => {
if (state && lastTarget?.getState?.()) {
const style = lastTarget.getStyle();
if (!stateTarget) {
stateTarget = cssc
.getAll()
.add({ selectors: "gjs-selected", style, important: true });
} else {
stateTarget.setStyle(style);
}
} else if (stateTarget) {
cssc.remove(stateTarget);
stateTarget = null;
}
});
this.model.set({ targets, lastTarget, lastTargetParents, stateTarget });
this.__upProps(opts);
// Update sectors/properties visibility
sectors.forEach((sector) => {
const props = sector.getProperties();
props.forEach((prop) => {
const isVisible = prop.__checkVisibility({
target: lastTarget,
component,
sectors,
});
prop.set("visible", isVisible);
});
const sectorVisible = props.some((p) => p.isVisible());
sector.set("visible", sectorVisible);
});
return targets;
},
Thanks for reporting this, @saudAtIrisdame.
Great question about Flex Property not working in style manager. The recommended approach with StyleManager is to use the event-driven API.
Start here:
- Check the GrapesJS documentation for your specific module
- Look for the
on()event listener method - Most operations can be achieved by listening to editor and component events
Common patterns:
// Listen for changes
editor.on('change', () => console.log('something changed'));
// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));
If you're still stuck:
- Share a minimal CodeSandbox reproduction
- Include what you've already tried
- Mention your GrapesJS version
- The community is here to help!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #4138
Unexpected behavior in style manager
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Version 1.35.101 Chromium: 98.0.4758.87 (Off...
Issue #4739
css class name with '/' converted to '-'
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Edge Version 107.0.1418.52 (Official build)...
Issue #5086
Style:property:update and Property onChange trigger excessively
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 112.0.5615.137 (Official Bu...
Issue #5229
textnode with content "null" is rendered as "null" not whitespace
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome Version 114.0.5735.199 (Official Buil...
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
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Tutorial
GrapesJS vs Webflow vs Tilda: What to Choose for Your Business in 2026
Choosing the right website platform in 2026 is no longer just about building a site
Tutorial
GJS Market 2.0 - Donations, Tracking, Labels and Better Product Discovery
We’ve rolled out a new set of GrapesJS marketplace updates across GJS Market, focused on improving how creators distribute products
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.