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

Commit a3477a8

Browse files
committed
fix(select): disabled option no longer reacting to hover and closing 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
1 parent 1ae16cb commit a3477a8

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/components/select/select-theme.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ md-select-menu.md-THEME_NAME-theme {
6464
}
6565
}
6666
}
67-
md-option:focus:not([selected]) {
67+
md-option:focus:not([disabled]):not([selected]) {
6868
background: '{{background-200}}';
6969
}
7070

src/components/select/select.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -1199,14 +1199,16 @@ function SelectProvider($$interimElementProvider) {
11991199
if (ev && ( ev.type == 'mouseup') && (ev.currentTarget != dropDown[0])) return;
12001200
if ( mouseOnScrollbar() ) return;
12011201

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

1205-
$mdUtil.nextTick(function() {
1206-
$mdSelect.hide(selectCtrl.ngModel.$viewValue);
1207-
}, true);
1207+
$mdUtil.nextTick(function () {
1208+
$mdSelect.hide(selectCtrl.ngModel.$viewValue);
1209+
}, true);
1210+
}
12081211
}
1209-
12101212
/**
12111213
* check if the mouseup event was on a scrollbar
12121214
*/

0 commit comments

Comments
 (0)