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

Dangling md-subheader and md-toolbar #2825

Closed
nobarany opened this issue May 12, 2015 · 7 comments
Closed

Dangling md-subheader and md-toolbar #2825

nobarany opened this issue May 12, 2015 · 7 comments
Assignees
Labels
needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue needs: feedback The issue creator or community need to respond to questions in this issue needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community
Milestone

Comments

@nobarany
Copy link

When a md-toolbar with md-scroll-shrink shrinks, the following subheader or md-toolbar doesn't move up to the top of the page, and it just dangles in the middle.
This codepen shows the problem for subheader, which appears only in Chrome (related to issues #1647 and #1726):
http://codepen.io/anon/pen/rVeaaL

But the problem with a second toolbar happens in Firefox as well:
http://codepen.io/anon/pen/QbNwQj

Interestingly, by adding md-scroll-shrink to the second toolbar you can achieve the behavior that you'd expect from the above code (i.e., the second one doesn't shrink).
http://codepen.io/anon/pen/MwyYvj

@nobarany nobarany reopened this May 12, 2015
@nobarany nobarany changed the title Dangling md-subheader Dangling md-subheader and md-toolbar May 12, 2015
@ThomasBurleson ThomasBurleson modified the milestone: Backlog May 28, 2015
@robertmesserle robertmesserle modified the milestones: 1.0-beta1, Backlog Aug 4, 2015
@naomiblack naomiblack modified the milestones: 1.0-beta1, 0.12.0 Aug 14, 2015
@topherfangio topherfangio added the needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community label Aug 24, 2015
topherfangio added a commit that referenced this issue Sep 2, 2015
If the subheader's parent `<md-content>` was not the top-level item,
the stickied subheader would be incorrectly positioned further down
the page.

Also added more tests to toolbar and fixed issue to ensure subheader
works with a toolbar using `md-scroll-shrink`.

Fixes #4420. References #2825.
topherfangio added a commit that referenced this issue Sep 2, 2015
If the subheader's parent `<md-content>` was not the top-level item,
the stickied subheader would be incorrectly positioned further down
the page.

Also added more tests to toolbar and fixed issue to ensure subheader
works with a toolbar using `md-scroll-shrink`.

Fixes #4420. References #2825. Closes #4439.
@topherfangio
Copy link
Contributor

@nobarany Recent updates to Angular Material (and Bower-Material) may already solve this issue. When you have a chance, can you use the latest code in master and confirm if the issue is resolved If not, please provide a CodePen demo that will ensure we validate fixes that also match your needs.

@topherfangio topherfangio added the needs: feedback The issue creator or community need to respond to questions in this issue label Sep 2, 2015
topherfangio added a commit that referenced this issue Sep 3, 2015
If the subheader's parent `<md-content>` was not the top-level item,
the stickied subheader would be incorrectly positioned further down
the page.

Also added more tests to toolbar and fixed issue to ensure subheader
works with a toolbar using `md-scroll-shrink`.

Fixes #4420. References #2825. Closes #4439.

Conflicts:
	src/components/toolbar/toolbar.js
	src/components/toolbar/toolbar.spec.js
kennethcachia pushed a commit to kennethcachia/material that referenced this issue Sep 23, 2015
If the subheader's parent `<md-content>` was not the top-level item,
the stickied subheader would be incorrectly positioned further down
the page.

Also added more tests to toolbar and fixed issue to ensure subheader
works with a toolbar using `md-scroll-shrink`.

Fixes angular#4420. References angular#2825. Closes angular#4439.
@ThomasBurleson ThomasBurleson modified the milestones: 1.0-rc1, 1.0-rc2, 1.0-rc3 Oct 27, 2015
@ThomasBurleson ThomasBurleson removed this from the 1.0-rc2 milestone Oct 30, 2015
@topherfangio topherfangio modified the milestones: 1.0-rc6, 1.0-rc3 Nov 3, 2015
@topherfangio topherfangio added the needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue label Nov 3, 2015
@topherfangio
Copy link
Contributor

Can you please provide a demo using the latest master code about exactly what you are attempting to accomplish?

I believe your first issue has been addresses, but I'm not exactly sure what you're wanting your second and third demos to do.

@nobarany
Copy link
Author

nobarany commented Nov 5, 2015

Yes, the first one works now, thanks! In the second demo, there are two toolbars: the first one is supposed to shrink as user scrolls down and the second one is supposed to stick to the top of the page. It still doesn't work (with the latest master code from gitcdn.xyz):
http://codepen.io/anon/pen/EVeEgb

@topherfangio
Copy link
Contributor

Okay, so I think you have three options here:

  1. Toolbar 1 Stays Visible and Toolbar 2 Shrinks - I don't think you need md-scroll-shrink. Just put the second toolbar inside of the md-content like this: http://codepen.io/topherfangio/pen/epLKmq
  2. Toolbar 2 Stays Visible and Toolbar 1 Shrinks - You can put the toolbars side-by-side and put the md-scroll-shrink on the Toolbar 2: http://codepen.io/topherfangio/pen/EVeRjj
  3. A variation of Button looks weird in dialog demo #2 - You put md-scroll-shrink on both and it still does the same as Button looks weird in dialog demo #2, but it gives a slightly different "push" effect rather than the "cover" effect: http://codepen.io/topherfangio/pen/zvJaBG

Do any of those meet your needs, or are you trying to do something else?

In general, the md-content has really only been designed to work with a single md-toolbar, so anything outside of that is probably going to require some customization.

@nobarany
Copy link
Author

nobarany commented Nov 5, 2015

Well, # 2 and 3 work for my needs. Thanks! But they shouldn't! The expected behavior is that the toolbar with md-shrink should shrink, not the other one. Am I missing something?

@topherfangio
Copy link
Contributor

The toolbars with md-scroll-shrink use a CSS transform to modify the position of the toolbar and make it disappear. So, it's not actually moving the toolbar anywhere.

So, using md-scroll-shrink on just Toolbar 1 does in fact do the intended (albeit strange) behavior because the component isn't actually moving and causing the page to re-flow and re-position/move Toolbar 2 upwards.

Since the most common case was to handle a single toolbar, that is what we optimized for. If we see a lot of people using it in a different manner, we may consider altering this and/or adding a new option.

If this is something you would like to see, could you please open a new issue with a description and ideally a video or Codepen of the effect you are wanting to create?

Since the original subheader issue is fixed, and we have a workaround for the second, I am going to go ahead and close this issue.

@nobarany
Copy link
Author

nobarany commented Nov 5, 2015

It works for me, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue needs: feedback The issue creator or community need to respond to questions in this issue needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community
Projects
None yet
Development

No branches or pull requests

5 participants