diff --git a/src/components/select/select.js b/src/components/select/select.js index 4339260931a..d337bd12837 100755 --- a/src/components/select/select.js +++ b/src/components/select/select.js @@ -715,7 +715,7 @@ function SelectProvider($$interimElementProvider) { left: parentNode.scrollLeft + SELECT_EDGE_MARGIN, top: parentNode.scrollTop + SELECT_EDGE_MARGIN, bottom: parentRect.height + parentNode.scrollTop - SELECT_EDGE_MARGIN, - right: parentRect.width - parentNode.scrollLeft - SELECT_EDGE_MARGIN + right: parentRect.width - SELECT_EDGE_MARGIN }, spaceAvailable = { top: targetRect.top - bounds.top, @@ -729,6 +729,7 @@ function SelectProvider($$interimElementProvider) { optionNodes = selectNode.getElementsByTagName('md-option'), optgroupNodes = selectNode.getElementsByTagName('md-optgroup'); + var centeredNode; // If a selected node, center around that if (selectedNode) { @@ -814,8 +815,9 @@ function SelectProvider($$interimElementProvider) { } // Keep left and top within the window - containerNode.style.left = clamp(bounds.left, left, bounds.right) + 'px'; - containerNode.style.top = clamp(bounds.top, top, bounds.bottom) + 'px'; + var containerRect = containerNode.getBoundingClientRect(); + containerNode.style.left = clamp(bounds.left, left, bounds.right - containerRect.width) + 'px'; + containerNode.style.top = clamp(bounds.top, top, bounds.bottom - containerRect.height) + 'px'; selectNode.style[$mdConstant.CSS.TRANSFORM_ORIGIN] = transformOrigin; selectNode.style[$mdConstant.CSS.TRANSFORM] = 'scale(' +