Skip to content

bug(CdkVirtualScrollViewport/CdkVirtualForOf): measureRangeSize ignores margins #19851

Closed
@StenCalDabran

Description

@StenCalDabran

measureRangeSize in CdkVirtualForOf uses the Elements getBoundingClientRect method to measure width or height of the DOM elements in the range. Unfortunately, this method ignores margins...
The method measureRangeSize in the CdkVirtualScrollViewport uses the one from CdkVirtualForOf and therefore has the same problem.

Expected Behavior

measureRangeSize should measure the total combined size of the elements in the given range.

Actual Behavior

Margins are ignored, leading to the method not actually returning the size of the complete range but rather the sum of sizes of all its element without the margins that may be between them.

Environment

  • Angular: 7.x - current (at least 10.0.1)
  • CDK/Material: 7.x - current (at least 10.0.1)
  • Browser(s): should be all
  • Operating System (e.g. Windows, macOS, Ubuntu): all

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/scrolling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions