-
Notifications
You must be signed in to change notification settings - Fork 3.4k
autocomplete: suggestion box not closing on blur #9581
Comments
Related to the planned gesture improvements - #9362 In meanwhile, disabling the $mdGestureProvider.skipClickHijack(); |
@devversion Has |
Quote from the source
Basically the Fastclick solution wouldn't be available for older devices anymore. A very good article about the ghost clicks (and Fastclick) |
Possible dupe of #8996 |
@clshortfuse Yeah those are kind of the same, but I personally prefer this one, because it includes more information e.g a workaround and why it's happening (also is about the input) We can close on of both :) |
@devversion Yep, I'm tagging |
@devversion I think we can more accurately target devices so click hijacking isn't done on newer devices. It's mix of reading the user agent, browser version and viewport scaling. I have to write it anyway for an app I'm writing. Of this top of my head, Safari Mobile pre-July 2016 need it and Android pre-2013/2014. I can get the exact version numbers later. |
@clshortfuse There is no need for Click hijacking with HammerJS anymore. We should just wait for this and not make any big changes to |
Closing this issue into #9362, since it will be solved automatically when HammerJS is used. |
I've found a hack that helps me get around this issue on the md-autocomplete suggestion box. This code is shortened to highlight the basics of how I did it:
<md-autocomplete
md-no-cache="true"
md-search-text="searchText"
md-items="i in querySearch(searchText)">
var unFocus = function(){
document.getElementsByTagName('md-autocomplete-wrap')[0].children[0].blur();
};
$scope.querySearch = function(q){
$timeout(function(){
var mask = document.getElementsByClassName('md-scroll-mask')[0];
if(mask) mask.addEventListener('click', unFocus, true);
},250)
//
// Return a list of results ....
} |
There was no CodePen demo, so I created this one. In this case I called |
I tried the CSS from the OP to hide the |
For some reason, on iOS, clicking on the I've looked into adding a |
OK, so this is caused by iOS Safari not firing Angular Material solves this by focusing the input when there is a click outside of the overlay. AngularJS Material does not have any current way to get access to the |
I'm not able to reproduce this issue on recent versions of Chrome for Android. I've got a PR ready to go that should fix this issue on iOS without any major API changes. It appears that listening on the |
Reopening #7419 as suggested by @EladBezalel
Actual Behavior:
Inputs are not blurred when tapping outside of a focussed input element.
The autocomplete suggestion box is not closing when the user taps outside the autocomplete to close the suggestion box without selecting a value.
This only happens on touch devices. Tested on Android/Chrome 52.0.2743.98 and iPhone/Safari 9.
When using the "Done" on iOS keyboard the suggestion box closes.
Hiding the keyboard on Android did not close the suggestion box.
Expected Behavior:
The autocomplete suggestion box should close when the user blurs the control by clicking/touching outside of it.
Additional Info
According to the comments in #7419 it worked in 0.11.4.
The issue might origin from function
mouseInputHijacker
and a quick-and-dirty fix for the autocomplete may be applying a css rule:The text was updated successfully, but these errors were encountered: