Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "List: correctly measure pages when using display: none.",
"type": "patch"
},
{
"comment": "",
"packageName": "@uifabric/utilities",
"type": "none"
},
{
"comment": "",
"packageName": "@uifabric/styling",
"type": "none"
},
{
"comment": "",
"packageName": "@uifabric/example-app-base",
"type": "none"
}
],
"email": "v-panu@microsoft.com"
}
24 changes: 13 additions & 11 deletions packages/office-ui-fabric-react/src/components/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -518,22 +518,24 @@ export class List extends BaseComponent<IListProps, IListState> {
if (pageElement && (!cachedHeight || cachedHeight.measureVersion !== this._measureVersion)) {
let newClientRect = _measurePageRect(pageElement);

hasChangedHeight = page.height !== newClientRect.height;
if (newClientRect.height || newClientRect.width) {
hasChangedHeight = page.height !== newClientRect.height;

// console.warn(' *** expensive page measure', page.startIndex, page.height, newClientRect.height);
// console.warn(' *** expensive page measure', page.startIndex, page.height, newClientRect.height);

page.height = newClientRect.height;
page.height = newClientRect.height;

this._cachedPageHeights[page.startIndex] = {
height: newClientRect.height,
measureVersion: this._measureVersion
};
this._cachedPageHeights[page.startIndex] = {
height: newClientRect.height,
measureVersion: this._measureVersion
};

this._estimatedPageHeight = Math.round(
((this._estimatedPageHeight * this._totalEstimates) + newClientRect.height) /
(this._totalEstimates + 1));
this._estimatedPageHeight = Math.round(
((this._estimatedPageHeight * this._totalEstimates) + newClientRect.height) /
(this._totalEstimates + 1));

this._totalEstimates++;
this._totalEstimates++;
}
}

return hasChangedHeight;
Expand Down