Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

<md-select> select dropdown not closing When clicked anywhere on Screen ? Not User Friendly #3701

Closed
prasad47 opened this issue Jul 13, 2015 · 11 comments
Assignees

Comments

@prasad47
Copy link

Hi,
Scenario Follows :-

Step 1 : Clicked on Md-select for selecting an Option.
Step 2: Instantly i decided No to Select Anything .
Step 3 : Clicked Some where on the Screen and Looking to Close Select Popup But Not Happening .

Screen Shot Attached from Documentation
bug
.

Thanks,
Prasad

@prasad47 prasad47 changed the title <md-select> select dropdown not closing When clicked anywhere on Screen ? <md-select> select dropdown not closing When clicked anywhere on Screen ? Not User Friendly Jul 13, 2015
@chucre
Copy link

chucre commented Jul 14, 2015

I think this is a duplicate issue with #3704

@prasad47
Copy link
Author

@chucre

Codepen :-
http://codepen.io/anon/pen/XbYjNY
The Example worked for the First Time and Same Persists from Next Try . Is there Any Solution for this as a Quickr :-) ?

@ThomasBurleson ThomasBurleson added the needs: review This PR is waiting on review from the team label Jul 31, 2015
@ThomasBurleson ThomasBurleson modified the milestone: REVISIT Jul 31, 2015
@rschmukler
Copy link
Contributor

This is fixed on master. Suspect it was a duplicate of #3704

@rschmukler rschmukler removed the needs: review This PR is waiting on review from the team label Aug 3, 2015
@Anujndls
Copy link

Anujndls commented Jul 3, 2017

I am also facing this kind of issue, when I open md-select with-in $mdDialog its not closing on-click at dialog body
abc

Please help me to find the solution..
Thanks,
Anuj

@kalidasweb
Copy link

same issue something wrong with the z-index

@Anujndls
Copy link

Anujndls commented Jul 7, 2017

when I googled then got a solution and finally it works for me with $mdDialog.

$window.addEventListener('click',function(e){
 $mdSelect.hide();
})

Please inject $window and $mdSelect in your controller..
Thanks

@izthuca
Copy link

izthuca commented Jul 13, 2017

@Anujndls , my select box close immediately after clicking it.

@izthuca
Copy link

izthuca commented Jul 13, 2017

I solved this using this code:

$mdDialog.show({
            clickOutsideToClose: true,
            onRemoving : function () {
                $scope.beforeClose();
            },
            scope: $scope,
            preserveScope: true
});
$scope.beforeClose = function(){
      $mdSelect.hide();
}

@tonyfa
Copy link

tonyfa commented Nov 11, 2017

this works fine for me, on the controller load event

vm.pressedonce = false;
document.body.onclick = function (e) {
if (vm.pressedonce)
$mdSelect.hide();
else
vm.pressedonce = true;
}

@keplertwofeek
Copy link

I think this two styles below could be a quick fix for this issue

.md-select-menu-container {
    z-index: 900;
}

md-backdrop.md-select-backdrop {
    z-index: 899;
}

@tonyfa
Copy link

tonyfa commented Nov 13, 2017

Yep sure does thanks, had the first style not the second. Always prefer to get it working using css thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants