Skip to content

Mobile device style groups incorrect order in _responsive.less #14476

Closed
@damiandawber

Description

@damiandawber

Style groups for mobile devices (max-width) are specified in the wrong order.

In lib/web/css/source/lib/_responsive.less the style groups run breakpoint-size ascending: 319px, 479px, 639px, 767px, which leads to outputting max-width media queries breakpoint-size ascending - the last-defined breakpoint overrides smaller screen size breakpoints...

Preconditions

Magento 2.2

Steps to reproduce

Specify styles referencing max media widths

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) {
        .logo {
            max-width: 165px;
        }
}

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
        .logo {
            max-width: 140px;
        }
}

Expected result

CSS should be output as follows:

@media only screen and (max-width: 639px) {
  .logo {
    max-width: 165px;
  }
}
@media only screen and (max-width: 479px) {
  .logo {
    max-width: 140px;
  }
}

Actual result

CSS is output as follows:

@media only screen and (max-width: 479px) {
  .logo {
    max-width: 140px;
  }
}
@media only screen and (max-width: 639px) {
  .logo {
    max-width: 165px;
  }
}

The last-defined breakpoint takes precedence over the 479px breakpoint even at screen sizes <= 479px.

Metadata

Metadata

Labels

Area: FrontendFixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions