Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toolbar: unable to specify attributes on first toolbar-row #1718

Closed
ThomasBurleson opened this issue Nov 3, 2016 · 7 comments · Fixed by #6661
Closed

toolbar: unable to specify attributes on first toolbar-row #1718

ThomasBurleson opened this issue Nov 3, 2016 · 7 comments · Fixed by #6661
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@ThomasBurleson
Copy link

ThomasBurleson commented Nov 3, 2016

Bug, feature request, or proposal:

md-toolbar projects content to an internal md-toolbar-row container and uses FlexBox css to layout in 'row' directions for that container. This means that custom CSS must be used to modify the direction to 'column'.

To achieve something like this is a challenge:

toolbar-flow-directions

And using the pending Layout API does not work:

<md-toolbar fx-layout="column">
    <div fx-layout="row" fx-layout-align="start center">  Title and buttons here </div>
    <div fx-flex="15px">        simulate a gap                                    </div>
    <div fx-layout="column">    2 lines of text organized vertically              </div>
</md-toolbar>

By default this will layout each child div in a single row instead of the requested column flow direction.

An option for the developer is to use custom CSS:

md-toolbar .md-toolbar-layout md-toolbar-row {
  flex-direction: column;
  align-content: flex-start;
  align-items: flex-start;
  min-height: 120px;
}

But this ^^ option is not intuitive and seems to violate the entire idea of the Layout API.

Another solution - of course - is that the developer can add a protection wrapper:

<md-toolbar>
   <div fx-layout="column">
      <div fx-layout="row" fx-layout-align="start center">  Title and buttons here </div>
      <div fx-flex="15px">        simulate a gap                                    </div>
      <div fx-layout="column">    2 lines of text organized vertically              </div>
   <div>
</md-toolbar>

but ^^ solution is dirty and adds complexity.

What are the steps to reproduce?

What is the use-case or motivation for changing an existing behavior?

I propose that all Layout APIs be transcluded to the md-toolbar-row element. This way the developer's original intent is preserved without additional workarounds or hacks.

@jelbourn jelbourn added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Nov 4, 2016
@devversion devversion changed the title toolbar : content project makes use of Layout API difficult toolbar: unable to specify attributes on first toolbar-row Dec 12, 2016
@AsherBarak
Copy link

Following #2279, here is my suggestion:
If the user has not specified any <md-toolbar-row> elements, generate first element and wrap content. If the user has created a <md-toolbar-row> element, treat it as first element.
Current state where we have the content of the first (implicit) element as the sibling of the second (explicit) element is 'hard on the eye'.
This also makes me wonder, in general, what should be done with content in the <md-toolbar> not in a <md-toolbar-row> element, which makes me wonder what exactly is the role of <md-toolbar-row> in the grand scheme of things. Not sure I get it...

@chrissena
Copy link

chrissena commented Jan 26, 2017

@rbj325 Don't think it is. How can flex-layout directives be applied to the first implicit md-toolbar-row (First Row), like they can for Second Row and Third Row?

Am I missing something?

@rbj325
Copy link

rbj325 commented Jan 26, 2017

@chrissena Misread. Redacted.

@EladBezalel
Copy link
Member

After some considerations we've come up with the idea of renaming the md-toolbar-row component into just md-toolbar and either rename the old md-toolbar into md-toolbar-group which will have multiple toolbars one on top of each other or we'd have an md-toolbar-multiline attribute (with the same purpose)

These changes aren't that urgent and can be bypassed with a single div wrapper, but in case it would happen in the future it would be considered a breaking change so better now than ever.

@MaximeAnsquer
Copy link

Sorry but I'm not sure I understand, is there currently a way to change the height of the first toolbar-row ? (I want a toolbar which is smaller than 64px).

Thank you very much.

@yogeshgadge
Copy link

It looks like there is just no hack to change the height because it comes from mat-toolbar-row which comes from <md-toolbar-row> which is auto generated and you can't override that. It is conventionally accurate to assume that if you include <md-toolbar-row> that would be your first row but this results into 2 rows.

devversion added a commit to devversion/material2 that referenced this issue Aug 27, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the first toolbar row will be only auto-generated if there is user content that can be projected into the default first row. This means that developers can now do the following:

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

Fixes angular#6004. Fixes angular#1718.
devversion added a commit to devversion/material2 that referenced this issue Aug 31, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

Fixes angular#6004. Fixes angular#1718.
devversion added a commit to devversion/material2 that referenced this issue Sep 1, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

Fixes angular#6004. Fixes angular#1718.
devversion added a commit to devversion/material2 that referenced this issue Sep 6, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

BREAKING CHANGE: `<md-toolbar-row>` elements will be no longer auto-generated for the first row. Meaning that custom styling for the first `<md-toolbar-row>` is no longer working as before. Since no toolbar-row is auto-generated anymore, there are two different modes for the toolbar now. Either place content directly inside of the `<md-toolbar>` or place multiple `<md-toolbar-row>` elements.

Fixes angular#6004. Fixes angular#1718.
devversion added a commit to devversion/material2 that referenced this issue Sep 16, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

BREAKING CHANGE: `<md-toolbar-row>` elements will be no longer auto-generated for the first row. Meaning that custom styling for the first `<md-toolbar-row>` is no longer working as before. Since no toolbar-row is auto-generated anymore, there are two different modes for the toolbar now. Either place content directly inside of the `<md-toolbar>` or place multiple `<md-toolbar-row>` elements.

Fixes angular#6004. Fixes angular#1718.
devversion added a commit to devversion/material2 that referenced this issue Sep 21, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

BREAKING CHANGE: `<md-toolbar-row>` elements will be no longer auto-generated for the first row. Meaning that custom styling for the first `<md-toolbar-row>` is no longer working as before. Since no toolbar-row is auto-generated anymore, there are two different modes for the toolbar now. Either place content directly inside of the `<md-toolbar>` or place multiple `<md-toolbar-row>` elements.

Fixes angular#6004. Fixes angular#1718.
devversion added a commit to devversion/material2 that referenced this issue Sep 22, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

BREAKING CHANGE: `<md-toolbar-row>` elements will be no longer auto-generated for the first row. Meaning that custom styling for the first `<md-toolbar-row>` is no longer working as before. Since no toolbar-row is auto-generated anymore, there are two different modes for the toolbar now. Either place content directly inside of the `<md-toolbar>` or place multiple `<md-toolbar-row>` elements.

Fixes angular#6004. Fixes angular#1718.
devversion added a commit to devversion/material2 that referenced this issue Sep 29, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

BREAKING CHANGE: `<md-toolbar-row>` elements will be no longer auto-generated for the first row. Meaning that custom styling for the first `<md-toolbar-row>` is no longer working as before. Since no toolbar-row is auto-generated anymore, there are two different modes for the toolbar now. Either place content directly inside of the `<md-toolbar>` or place multiple `<md-toolbar-row>` elements.

Fixes angular#6004. Fixes angular#1718.
devversion added a commit to devversion/material2 that referenced this issue Oct 5, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

BREAKING CHANGE: `<md-toolbar-row>` elements will be no longer auto-generated for the first row. Meaning that custom styling for the first `<md-toolbar-row>` is no longer working as before. Since no toolbar-row is auto-generated anymore, there are two different modes for the toolbar now. Either place content directly inside of the `<md-toolbar>` or place multiple `<md-toolbar-row>` elements.

Fixes angular#6004. Fixes angular#1718.
andrewseguin pushed a commit that referenced this issue Oct 31, 2017
Currently the toolbar always generates the first `<md-toolbar-row>`. This means that developers have no opportunity to set directives/attributes/classes on the first toolbar row (e.g with flex-layout).

With this change, the toolbar won't auto-generate any `<md-toolbar-row>` element.

The toolbar will have two different row modes:

_Single row toolbar_

```html
<md-toolbar>
  First Tow
</md-toolbar>
```

_Multiple rows toolbar_

```html
<md-toolbar>
  <md-toolbar-row>First Row</md-toolbar-row>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

This means that mixing those two row modes is no longer possible and allowed

```html
<md-toolbar>
  <span>First Row</span>
  <md-toolbar-row>Second Row</md-toolbar-row>
</md-toolbar>
```

BREAKING CHANGE: `<md-toolbar-row>` elements will be no longer auto-generated for the first row. Meaning that custom styling for the first `<md-toolbar-row>` is no longer working as before. Since no toolbar-row is auto-generated anymore, there are two different modes for the toolbar now. Either place content directly inside of the `<md-toolbar>` or place multiple `<md-toolbar-row>` elements.

Fixes #6004. Fixes #1718.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants