Issue #1996Opened May 2, 2019by prosenjit-manna0 reactions

Mobile first: Media query ordering issue

Question

  1. Are you using the latest release (older versions are NOT supported)? - 0.14.61
  2. Are you facing the bug with your local copy of GrapesJS or with the current demo? - I am facing the issue with both local and 'https://unpkg.com/grapesjs'
  3. The issue is mobile first media query ordering issue. With the current version media query ordering status is
@media (min-width: 1367px)
@media (min-width: 1024px)
@media (min-width: 320px)
  1. What is the expected behavior?
@media (min-width: 320px)
@media (min-width: 1024px)
@media (min-width: 1367px)

I tried to fix the sorting in the correct order.

sortMediaObject: function sortMediaObject() {
 ...
   if (a.key.includes('min-width') && b.key.includes('min-width')) {
       return  _this4.getQueryLength(a.key) - _this4.getQueryLength(b.key);
     } else {
      return  _this4.getQueryLength(b.key) - _this4.getQueryLength(a.key);
     }
...
}

Is it a good solution? If so, please include this.

Answers (3)

artfMay 11, 20190 reactions

Seems legit. I'll add it in the next release

Palash-MandalJuly 13, 20220 reactions

Hello @artf @prosenjit-manna , Can you please help me that the feature is requested by @prosenjit-manna is implemented in the latest /*! grapesjs - 0.19.4 */ version ???

I have faced issues while mobile first approach CSS ordering is randomized.

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.