diff --git a/common/changes/listToUpdatePagesFromDisplayNone_2017-04-24-09-42.json b/common/changes/listToUpdatePagesFromDisplayNone_2017-04-24-09-42.json new file mode 100644 index 00000000000000..3f8137ac729474 --- /dev/null +++ b/common/changes/listToUpdatePagesFromDisplayNone_2017-04-24-09-42.json @@ -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" +} \ No newline at end of file diff --git a/packages/office-ui-fabric-react/src/components/List/List.tsx b/packages/office-ui-fabric-react/src/components/List/List.tsx index 010b8b486ac52e..6efd8382501966 100644 --- a/packages/office-ui-fabric-react/src/components/List/List.tsx +++ b/packages/office-ui-fabric-react/src/components/List/List.tsx @@ -518,22 +518,24 @@ export class List extends BaseComponent { 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;