Financial-Times / o-grid

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

enableLayoutChangeEvents does not support custom layouts #286

Closed notlee closed 3 years ago

notlee commented 3 years ago

It is possible to add a custom layout (breakpoint) to the grid:

@include oGridAddLayout(
    $layout-name: XS,
    $layout-width: 360px
);

However the enableLayoutChangeEvents method, which sets up event listeners to fire when layouts change, does not correctly fire for custom layouts. It fires layout change events for any custom layout when the default layout change is fired, regardless of the size of the custom layout.

Thoughts on potential solution:

This was reported by the apps team who both set custom layouts and use layout change events. It's not causing an immediate problem but was a good spot by @erayb, thanks for letting us know!

notlee commented 3 years ago

Looks like oGridAddLayout already errors if the unit of the layout does not match other layouts