material icon indicating copy to clipboard operation
material copied to clipboard

Md Autocomplete: Blur on selected element (enhancement)

Open tiny-dancer opened this issue 11 years ago • 6 comments

Couldn't find this through docs/google. Unless i am missing something, it would appear to be helpful to allow the input for autocomplete to blur when selecting an item. In devices this would naturally allow the keyboard to hide from the screen.

Thanks and great work

tiny-dancer avatar Jul 31 '15 21:07 tiny-dancer

+1

photusenigma avatar Oct 30 '15 16:10 photusenigma

+1

johnSowingo avatar Nov 27 '15 15:11 johnSowingo

+1

egystr avatar Dec 29 '15 14:12 egystr

Was this fixed or any update on this?

ninetwentyone avatar Mar 04 '16 18:03 ninetwentyone

I don't understand how this is not something that is not a bit more documented, it seems to be the natural behaviour on mobile, to close the keyboard when selecting an item. I'm looking for workarounds but haven't found much.

Edit: I ended up calling blur manually: angular.element(document.querySelector('autocomplete-id'))[0].querySelector('input').blur() on md-selected-item-change.

Doesn't seem to break anything and it hides the keyboard on mobile. I don't know why this is not the default behaviour.

leolozes avatar May 01 '17 09:05 leolozes

If anyone was wondering, this worked in Angular v4 for me. setTimeout(function () { document.getElementById("input-id").blur(); },0);

tokyoite avatar Jun 05 '17 04:06 tokyoite