Media query and classes rendering issue
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 t...
Read full answer below β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 #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 #5221
Desktop Version on incorrectly mobile device
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Safari 16.5Reproducible demo link https://gr...
Issue #2824
Dragging items do not position on intital drag?
So when I drag a component/item from the bar to the center it will not go where I told it to go... IT always goes about 20% page width to o...
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 Inline RTE Plugins Update: CKEditor 5 v0.1.4 and Froala Inline Text Editor
CKEditor 5 Inline for GrapesJS v0.1.4 fixes Studio SDK toolbar clipping, iframe injection and link balloon bugs. Compare with Froala Inline β both $69.
Tutorial
Embed GrapesJS in Your SaaS: A Weekend Guide
Embed GrapesJS in your SaaS and ship a white-label page builder over a weekend. Honest tradeoffs, real code, and the plugins that close the UX gap.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.