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

fix(autocomplete): Allow clicks inside md-not-found. #5564

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/autocomplete/js/autocompleteController.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
* Handles input blur event, determines if the dropdown should hide.
*/
function blur () {
hasFocus = false;
if (!noBlur) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertmesserle Can you think of any reason why the hasFocus was outside of the if statement? All tests pass after moving it and my manual testing didn't show any differences except that it fixed my bug.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is so that we know when the element lost focus so that we can refocus when they leave the dropdown. This was related to ie 11.

Sent from my iPhone

On Nov 4, 2015, at 3:43 PM, Topher Fangio notifications@github.com wrote:

In src/components/autocomplete/js/autocompleteController.js:

@@ -359,8 +359,8 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
* Handles input blur event, determines if the dropdown should hide.
*/
function blur () {

  • hasFocus = false;
    @robertmesserle Can you think of any reason why the hasFocus was outside of the if statement? All tests pass after moving it and my manual testing didn't show any differences except that it fixed my bug.


Reply to this email directly or view it on GitHub.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I restored it:

  function blur () {
    hasFocus = false;
    if (!noBlur) {
      ctrl.hidden = shouldHide();
    }
  }

hasFocus = false;
ctrl.hidden = shouldHide();
}
}
Expand All @@ -370,7 +370,10 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
* @param forceBlur
*/
function doBlur(forceBlur) {
if (forceBlur) noBlur = false;
if (forceBlur) {
noBlur = false;
hasFocus = false;
}
elements.input.blur();
}

Expand Down Expand Up @@ -408,6 +411,9 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
updateMessages();
break;
case $mdConstant.KEY_CODE.TAB:
// If we hit tab, assume that we've left the list so it will close
onListLeave();

if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return;
select(ctrl.index);
break;
Expand Down