Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

layout: flex-val inside layout-row and layout-column prevents media-dependent auto width #11466

Open
WebTechnolog opened this issue Sep 28, 2018 · 2 comments
Assignees
Labels
has: Pull Request A PR has been created to address this issue P4: minor Minor issues. May not be fixed without community contributions. type: enhancement ui: layout
Milestone

Comments

@WebTechnolog
Copy link

WebTechnolog commented Sep 28, 2018

Bug:

Too specific "flex-val" selectors prevent applying media-dependent "auto" rules.

CodePen and steps to reproduce the issue:

CodePen Demo which demonstrates the issue

Detailed Reproduction Steps:

  1. Put a flex="100" div inside layout="row"
  2. Add flex-gt-sm="auto" to it

What is the expected behavior?

The described div's width should be "100%" on < 960px and "auto" on >= 960px

What is the current behavior?

The rule .layout-row > .flex-100 prevents @media (min-width: 960px) { .flex-gt-sm-auto {...} } from happening

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.6.9
  • AngularJS Material: 1.1.10
@WebTechnolog WebTechnolog changed the title flex-val inside layout-row and layout-column flex-val inside layout-row and layout-column prevents media-dependent auto width Sep 28, 2018
@bersLucas
Copy link
Contributor

bersLucas commented Sep 28, 2018

We can fix this by adding the .layout-row > to the not-valued layout rules (grow, auto, ect)

.#{$flexName}-grow { flex: 1 1 100%; box-sizing: border-box; }

  .layout-row > .#{$flexName}-grow        { flex: 1 1 100%;  box-sizing: border-box; }
  .layout-row > .#{$flexName}-initial     { flex: 0 1 auto;  box-sizing: border-box; }
  .layout-row > .#{$flexName}-auto        { flex: 1 1 auto;  box-sizing: border-box; }
  .layout-row > .#{$flexName}-none        { flex: 0 0 auto;  box-sizing: border-box; }
  .layout-row > .#{$flexName}-noshrink    { flex: 1 0 auto;  box-sizing: border-box; }
  .layout-row > .#{$flexName}-nogrow { flex: 0 1 auto; box-sizing: border-box; }

  .layout-column > .#{$flexName}-grow        { flex: 1 1 100%;  box-sizing: border-box; }
  .layout-column > .#{$flexName}-initial     { flex: 0 1 auto;  box-sizing: border-box; }
  .layout-column > .#{$flexName}-auto        { flex: 1 1 auto;  box-sizing: border-box; }
  .layout-column > .#{$flexName}-none        { flex: 0 0 auto;  box-sizing: border-box; }
  .layout-column > .#{$flexName}-noshrink    { flex: 1 0 auto;  box-sizing: border-box; }
  .layout-column > .#{$flexName}-nogrow { flex: 0 1 auto; box-sizing: border-box; }
}

Does anybody else have some input on a better way or a reason to not do this before I submit a PR? Specifically, should .flex-gt-sm-auto have priority here over .flex-100?

In the meantime, you can add this to your project to get it working for now

.layout-row > .flex-gt-sm-auto {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    box-sizing: border-box;
}

@Splaktar Splaktar changed the title flex-val inside layout-row and layout-column prevents media-dependent auto width layout: flex-val inside layout-row and layout-column prevents media-dependent auto width Oct 3, 2018
@Splaktar Splaktar self-assigned this Oct 3, 2018
@Splaktar Splaktar added ui: layout has: Pull Request A PR has been created to address this issue P4: minor Minor issues. May not be fixed without community contributions. labels Oct 3, 2018
@Splaktar Splaktar added this to the 1.1.12 milestone Oct 3, 2018
@Splaktar
Copy link
Member

Splaktar commented Oct 3, 2018

There are some layout changes already in master for 1.1.11, so it's important to test this against those. I've updated the CodePen to use the latest master and this is indeed still an issue.

From the bug report, I thought that maybe the media-dependent styles were being overwritten. However in the debugger, it appears that they aren't even being applied/activated at all.

@Splaktar Splaktar modified the milestones: 1.1.12, 1.1.13 Jan 3, 2019
@Splaktar Splaktar modified the milestones: 1.1.13, 1.1.14 Feb 10, 2019
@Splaktar Splaktar modified the milestones: 1.1.14, 1.1.15 Mar 14, 2019
@Splaktar Splaktar modified the milestones: 1.1.15, 1.1.16, 1.1.18, 1.1.19 Mar 29, 2019
@Splaktar Splaktar modified the milestones: 1.1.19, 1.1.20 May 30, 2019
@Splaktar Splaktar modified the milestones: 1.1.20, 1.1.21 Aug 15, 2019
@Splaktar Splaktar modified the milestones: 1.1.21, 1.1.22 Sep 30, 2019
@Splaktar Splaktar removed this from the 1.1.22 milestone Oct 22, 2019
@Splaktar Splaktar added this to the 1.1.23 milestone Oct 22, 2019
@Splaktar Splaktar modified the milestones: 1.1.23, 1.2.1 Jun 8, 2020
@Splaktar Splaktar modified the milestones: 1.2.1, 1.2.2 Sep 14, 2020
@Splaktar Splaktar modified the milestones: 1.2.2, - Backlog Oct 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue P4: minor Minor issues. May not be fixed without community contributions. type: enhancement ui: layout
Projects
None yet
Development

No branches or pull requests

3 participants