Financial-Times / o-grid

Responsive grid system
http://registry.origami.ft.com/components/o-grid
94 stars 17 forks source link

BUG: `/* autoprefixer: off */` #175

Closed gvonkoss closed 5 years ago

gvonkoss commented 5 years ago

What

Autoprefixer isn't working as expected

Details

oGridContainer() and oGridColspan() are both switching off the autoprefixer in order to add prefixes that support FF < 29 (-moz). This is being done by switching autoprefixer off (/* autoprefixer: off*/) — however, it hasn't been switched back on anywhere. Due to the nature of autoprefixer, that specific comment disables autoprefixer for the whole block it is in.

This is a problem for any users that are using those two SCSS mixins within blocks of their own, e.g.:

.example-container {
  @include oGridContainer();
  display: flex;
}

The switched-off prefixer is included in the .example-container block, meaning that the autoprefixer will not work on the display: flex; example above.

The interim solution has been to add the following to the code:

  // sass-lint:disable no-vendor-prefixes
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  // sass-lint:enable no-vendor-prefixes
  /*autoprefixer: ignore-next*/
  box-sizing: border-box;

Which will only switch autoprefixer off for box-sizing, after the older vendor prefixes have been declared. Otherwise, autoprefixer will overwrite everything.

This solution isn't ideal, because it can generate an issue with source order—but it is an interim patch until we discover whether or not we can remove the -moz- prefix entirely so that the autoprefixer can run normally. This depends on our browser support.

i-like-robots commented 5 years ago

A note if it helps: The oldest Firefox ESR is v31 which was released in October 2015. ESR releases are supported for 1 year officially.

On a related note the box-sizing property has been supported unprefixed by Webkit/Blink based browsers since Safari 5.1 (July 2011), Chrome 10 (March 2011), Android 4 (October 2013), and BB10 (January 2013) so I'm definitely behind removing the prefixed rules =]

gvonkoss commented 5 years ago

Given all feedback and discovery of our actual browser support, we've opted for removing the autoprefixing control comments altogether 🎉