From 519afc749640c530506720816197e94683f8eb21 Mon Sep 17 00:00:00 2001 From: Patrik Pacin Date: Mon, 23 May 2016 09:03:01 +0200 Subject: [PATCH] getBoundingClientRect() incorrectly reports width for hidden containers It is not possible to use minigrid on hidden container e.g. Bootstrap navbar menu items. Firstly you have to set display to initial and reset back --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index 4671ced..370d6e3 100644 --- a/src/index.js +++ b/src/index.js @@ -55,6 +55,7 @@ var itemsNodeList = this.props.nodeList; containerEle.style.width = ''; + containerEle.style.display = 'initial'; var forEach = Array.prototype.forEach; var containerWidth = containerEle.getBoundingClientRect().width; @@ -97,6 +98,8 @@ }); + containerEle.style.display = ''; + var containerHeight = itemsGutter .slice(0) .sort(function (a, b) {