Skip to content

MdGridList cannot switch between ratio and fixed row height #4047

@arlowhite

Description

@arlowhite

Bug:

Switching from ratio to fixed height causes tiles to have larger heights than they should.

This is because RatioTileStyler uses paddingTop and FixedTileStyler uses height to set tile heights. But when switching between them, the old styles are not cleared.

What is the expected behavior?

Users should be able change rowHeight between ratio, fixed, and fit dynamically.

What is the current behavior?

Switching between fixed and ratio rowHeight modes results in tiles that are larger than they should be due to left-over styles.
Have not tested 'fit' mode.

What are the steps to reproduce?

I reproduced this with unit tests in grid-list.spec.ts
https://github.com/arlowhite/material2/tree/grid-rowheight-bug

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

Users can hit this bug easily, even if they aim to stick with fixed mode.
If their Component loads with rowHeight undefined, grid will default to "1:1"
Then when they set a number to rowHeight, this bug will occur.

Which versions of Angular, Material, OS, browsers are affected?

Affects 2.0.0-beta.3
material2 master 9d719c5

Angular 4.0.1

Is there anything else we should know?

I will submit a PR with the unit test.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthelp wantedThe team would appreciate a PR from the community to address this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions