Issue #1224Opened June 20, 2018by peakrams0 reactions

[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)

peakramsJuly 5, 20180 reactions

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.

peakramsSeptember 3, 20180 reactions

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.

artfSeptember 5, 20180 reactions

@peakrams, unfortunately, no one worked on this

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.