material icon indicating copy to clipboard operation
material copied to clipboard

md-list-item: each item takes full height of the screen

Open btmura opened this issue 10 years ago • 6 comments

Each md-list-item takes the full height of the screen. Each md-list-item should take enough height of its content.

  1. Copy and paste the code in this tutorial below and see that it works: http://www.tutorialspoint.com/angular_material/angular_material_list.htm
  2. Change the Angular Material version to the 1.1.0-rc5 and refresh the page.
  3. Note how the list items are the full height of the screen.

Affected: Chrome 51 on Windows, Chrome 41 on Linux Not affected: Firefox 47.01 Windows, Firefox 45.2 Linux

btmura avatar Jul 06 '16 00:07 btmura

This should be fixed within master. Can you create a codepen?

It seems like I can't reproduce that in v1.1.0-rc.5 as well

http://codepen.io/DevVersion/pen/pbwXpd

devversion avatar Jul 06 '16 05:07 devversion

I'm seeing the same issue, and for the life of me can't reproduce it in a codepen. With 1.1.0-rc5 and with the current HEAD. Only on chrome, and only if a ng-click handler is set on the md-list-item.

The problem seems to be that the div.md-list-item-inner has height: 100%, as a workaround I can set

.md-list-item-inner {
    height: inherit !important;
}

The parent has height: auto, so the percent height of the child should be ignored:

The percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the value computes to 'auto'.

But isn't on chrome for some reason. This seems to be a chrome layout bug; Its mysterious to me why it isn't triggered on codepen.

vbraun avatar Jul 15 '16 12:07 vbraun

@vbraun Pretty difficult, if we're not able to reproduce that on a codepen.

Can you please provide some screenshots (DevTools / DOM etc.) ?

devversion avatar Jul 15 '16 16:07 devversion

So after a fun debugging session I found that this is because of a missing <!DOCTYPE html>. When I add it, list items have the correct height. But without it, list items are screen height high in chrome. Which also explains why it can't be reproduced on codepen, as that helpfully adds the doctype for you ;-)

vbraun avatar Jul 15 '16 19:07 vbraun

@vbraun Thanks for the information. It helped me to reproduce your issue.

devversion avatar Jul 15 '16 20:07 devversion

FYI, adding appears to cause layout-fill to stop working.

davidpoxon avatar Aug 04 '16 22:08 davidpoxon