[Bug] Media query and classes rendering issue
Question
Hi,
I was trying to make a responsive layout but I discovered that the device switcher does not work consistently. The issue can be replicated in the official demo.
Open http://grapesjs.com/demo.html Keep the "Desktop" as the selected device. Add at the top of the "Header" 2 block of type "2 Columns" (just above the menu). Select the first "Row" inserted and set its padding-left to 100px. Select the second "Row" inserted and set its padding-left to 100px. Switch to the device "Tablet". Add the class "np" to the selected "Row" (switching the device does not deselect it) and change its padding to 10px. Select the first "Row" and add the class np.
The rendered padding-left is not updated, it is 100px, while I expect it to become 10. NOT good.
Switch the device to "Desktop", the padding-left of both rows is 100px. Good. Switch the device to "Tablet", the padding-left of both rows is 10px. Good. Switching multiple times all the devices the padding-left is updated correctly. Good.
Another example.
Open http://grapesjs.com/demo.html Keep the "Desktop" as the selected device. Add at the top of the "Header" 2 block of type "2 Columns" (just above the menu). Select the first "Row" inserted and set its padding-left to 100px. Select the second "Row" inserted and set its padding-left to 100px. Switch to the device "Tablet". Add the class "np" to the selected "Row" (switching the device does not deselect it) and change its padding to 10px. Select the first "Row" and add the class np.
The rendered padding-left is not updated, it is 100px, while I expect it to become 10.
Switch the device to "Smartphone", the padding-left of both rows is 100px. NOT Good. Switch the device to "Tablet", the padding-left of both rows is 10px. Good. Switch the device to "Desktop", the padding-left of both rows is 10px. NOT Good. Switching multiple time does not solve the issue. NOT Good.
Answers (3)
Hello.
There is or there will be any update about this issue? I've just tried to replicate it in the demo and the issue still persist. Unfortunately, I know only basic JS so I can't think of a way to fix this beaheviour myself.
I don't know if it is related to my issue but, inspecting the code, in the file config.js the width of the device Tablet is the same as the withMedia of the device Mobile landscape; in this way, the custom style applyed to Mobile landscape via media query won't persist in the canvas switching the device to Tablet? (I didn't try this one, since there is no Mobile landscape in the devices panel.)
Thank you.
Hi,
can someone help me with this issue? I have just replicated (in the demo) the second example I have provided in the opening post and it seems that nothing has changed from the last time.
Thank you.
@peakrams, unfortunately, no one worked on this
Related Questions and Answers
Continue research with similar issue discussions.
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 #3260
BUG: Color Picker Transparency slider is at 0 in firefox.
The color picker in grapesjs does not work the same between Chrome and Firefox. When you open the picker on a selected component that has n...
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 #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.