Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

layout-align: Resetting to default when only one argument #5996

Closed
epelc opened this issue Nov 30, 2015 · 4 comments
Closed

layout-align: Resetting to default when only one argument #5996

epelc opened this issue Nov 30, 2015 · 4 comments

Comments

@epelc
Copy link
Contributor

epelc commented Nov 30, 2015

layout-align no longer works with a single argument. It will replace it with layout-align="start-stretch" which drastically changes layouts.

One Example
layout-align="space-around" no longer works since 1.0.0-rc5. It is replaced with layout-align="start-center" when it should default the second argument to center ie parse layout-align="space-around" as layout-align="space-around center".

This also happens with the other single argument usecases like layout-align="space-between". I'm suspectting the recent change to the default layout-align introduced this issue.

@ngraef
Copy link
Contributor

ngraef commented Dec 1, 2015

The issue is in layout.js line 437:

var values = (value || "").replace(WHITESPACE, "-").split("-");
if ( values.length == 3 ) {
  values = [ values[0]+"-"+values[1],values[2] ];
}

The conditional check for values.length == 3 assumes that a cross axis argument was provided if the main axis is space-around or space-between.

I'll submit a PR.

ngraef added a commit to ngraef/material that referenced this issue Dec 1, 2015
* fix parsing issue to allow single value
* add demo to test omitting second value

fixes angular#5996
@julienpa
Copy link

julienpa commented Dec 1, 2015

But the default cross-axis value is stretch in Flexbox specification, and it is the one applied if you don't specify the second parameter, as the doc states:
https://material.angularjs.org/latest/layout/alignment

Or am I missing something?

@ngraef
Copy link
Contributor

ngraef commented Dec 1, 2015

@julienpa Correct. There's just a parsing issue if the only value provided is space-around or space-between. It gets processed as two separate values (i.e. space around), neither of which is a valid value, so it gets replaced by the default start stretch.

@julienpa
Copy link

julienpa commented Dec 1, 2015

@ngraef ok, I understood now. Can it be linked in any way with the problem I describe in #5979?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants