mediaCondition: "min-width" breakpoints not applying the correct style in canvas
Question
Hi,
I'm having some issue with mobile first approach. The canvas render the wrong style when setting different styles at multiple breakpoints. But the code generated is good, this issue only happen in the canvas.
https://codesandbox.io/s/xenodochial-shockley-s02lp?file=/index.js:496-524
const breakpoints = [
{ name: "xs", width: "320px" },
{ name: "xsLg", width: "400px" },
{ name: "sm", width: "630px" },
{ name: "md", width: "740px" },
{ name: "lg", width: "1024px" },
{ name: "xl", width: "1280px" },
{ name: "xxl", width: "1800px" }
];
const editor = grapesjs.init({
container: "#gjs",
fromElement: 1,
storageManager: { type: 0 },
mediaCondition: "min-width",
deviceManager: { devices: breakpoints },
plugins: ["gjs-blocks-basic"]
});

- Are you using the latest release (older versions are NOT supported)? Yes using 0.16.12
- Are you facing the bug with your local copy of GrapesJS or with the current demo? With my local copy
- If a local copy
- Indicate all informations about your OS, browser and GrapesJS version.
MacOs, tried on firefox and Chrome and same issue
- Indicate all informations about your OS, browser and GrapesJS version.
- What is the expected behavior? Still should change according to the breakpoint in the canvas when using mediaCondition: "min-width"
- What happens instead? Style in canvas only apply the change from the 1st breakpoint. but the code in the export view is right. The issue is only in how the canvas render.
- If you're able to reproduce the bug indicate all the necessary steps
- Follow this codesandbox https://codesandbox.io/s/xenodochial-shockley-s02lp?file=/index.js:496-524
- Change the device to xs
- Select the copy box and change the color of this one
- Change the device to md
- Select the copy box and change the color of this one to a new color, the color is still the old one from xs
- Desktop first works fine
Thanks a lot for your help
Answers (1)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #896
[BUG] Media query rules are overridden by class rules in canvas
Hi @artf , I've noticed an issue while testing one of my templates using different device configurations that supposed to trigger media que...
Issue #1506
Css Media Query Issue
Hello @artf There is an issue on demo page as well as library in media query. Issue is that if user update style on mobile view first and t...
Issue #2656
[BUG] Wrong position of toolbar when duplicate children component
Hi, you can check this example: https://codepen.io/abozhinov/pen/XWbqjEJ Steps to reproduce the problem:If components existing delete them...
Issue #3267
BUG: Cannot set 0px box shadow blur
For some reason, the editor does not allow to set the blur to 0px. 0 always magically turns into 5px. <img width="243" alt="Screenshot 2021...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.