Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(select): fix positioning when using option groups
Browse files Browse the repository at this point in the history
references #3594
  • Loading branch information
rschmukler committed Jul 12, 2015
1 parent 898fd9b commit d8d3e4c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1018,20 +1018,23 @@ function SelectProvider($$interimElementProvider) {
selectNode.classList.add('md-overflow');
}

var focusedNode = centeredNode;
if ((focusedNode.tagName || '').toUpperCase() === 'MD-OPTGROUP') {
focusedNode = optionNodes[0] || contentNode.firstElementChild || contentNode;
centeredNode = focusedNode;
}

// Get the selectMenuRect *after* max-width is possibly set above
var selectMenuRect = selectNode.getBoundingClientRect();
var centeredRect = getOffsetRect(centeredNode);


if (centeredNode) {
var centeredStyle = $window.getComputedStyle(centeredNode);
centeredRect.paddingLeft = parseInt(centeredStyle.paddingLeft, 10) || 0;
centeredRect.paddingRight = parseInt(centeredStyle.paddingRight, 10) || 0;
}

var focusedNode = centeredNode;
if ((focusedNode.tagName || '').toUpperCase() === 'MD-OPTGROUP') {
focusedNode = optionNodes[0] || contentNode.firstElementChild || contentNode;
}

if (isScrollable) {
var scrollBuffer = contentNode.offsetHeight / 2;
Expand Down

0 comments on commit d8d3e4c

Please sign in to comment.