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

Commit

Permalink
fix(select): disabled option no longer reacting to hover and closing …
Browse files Browse the repository at this point in the history
…on click

Added a not disabled check before closing menu,
Now when clicking the menu anywhere but a valid option the menu closing will be prevented

fixes #4967
  • Loading branch information
EladBezalel committed Nov 8, 2015
1 parent 1ae16cb commit a3477a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/select/select-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ md-select-menu.md-THEME_NAME-theme {
}
}
}
md-option:focus:not([selected]) {
md-option:focus:not([disabled]):not([selected]) {
background: '{{background-200}}';
}

Expand Down
14 changes: 8 additions & 6 deletions src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1199,14 +1199,16 @@ function SelectProvider($$interimElementProvider) {
if (ev && ( ev.type == 'mouseup') && (ev.currentTarget != dropDown[0])) return;
if ( mouseOnScrollbar() ) return;

if (!selectCtrl.isMultiple) {
opts.restoreFocus = true;
var option = $mdUtil.getClosest(ev.target, 'md-option');
if (option && option.hasAttribute && !option.hasAttribute('disabled')) {
if (!selectCtrl.isMultiple) {
opts.restoreFocus = true;

$mdUtil.nextTick(function() {
$mdSelect.hide(selectCtrl.ngModel.$viewValue);
}, true);
$mdUtil.nextTick(function () {
$mdSelect.hide(selectCtrl.ngModel.$viewValue);
}, true);
}
}

/**
* check if the mouseup event was on a scrollbar
*/
Expand Down

0 comments on commit a3477a8

Please sign in to comment.