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

typeahead remains invalid if the user write a full suggestion vaue #3423

Closed
abou-emish opened this issue Mar 23, 2015 · 11 comments
Closed

typeahead remains invalid if the user write a full suggestion vaue #3423

abou-emish opened this issue Mar 23, 2015 · 11 comments

Comments

@abou-emish
Copy link

typeahead remains invalid if the user write a full suggestion in the input without selecting it from the suggestion. when typeahead-editable="false"

@wesleycho
Copy link
Contributor

Can you reproduce this in a Plunker and give more details?

@RobJacobs
Copy link
Contributor

Here is a plunk I used to test required validation. @emaish Please feel free to update this plunk accordingly to demonstrate your issue.

@abou-emish
Copy link
Author

Sorry i was away from my laptop, i updated the plunk with attribute typeahead-editable="false",
when you click "tab" key it's fine and the item selected and the model update, but if you write the whole word Alabama and just clicked away with the mouse the model not updated

@RobJacobs
Copy link
Contributor

This is because when using the Tab or Enter key, it calls the:

element.bind('keydown', function (evt)

and then falls into

else if (evt.which === 13 || evt.which === 9) {
    scope.$apply(function () {
        scope.select(scope.activeIdx);
      });

Where the dismissClickHandler function calls resetMatches() and closes the popup. Not sure if this is desired behavior or not.

@abou-emish
Copy link
Author

It should be configurable at least, because when using typeahead-editable="false" the directive should accept the proper value by all means and revert to blank otherwise, leaving text in the input isn't consistent with the nature of this attribute "imo" this attribute should act as following
1- if value isn't among the suggested then it's invalid so model and input should revert to previous state
2- input bluring should be handled as tab and enter keys, because some users is used to work with mouse and they may want to move to next input or functionality by clicking

@wesleycho
Copy link
Contributor

Looking at this, I think I agree. Marked as a bug.

@karianna karianna added this to the Backlog milestone Mar 24, 2015
@abou-emish
Copy link
Author

i think #3365 is related

@wesleycho
Copy link
Contributor

That issue is a little different.

@abou-emish
Copy link
Author

While using the typeahead directive, we desired that it automatically select an item when the user
input exactly matches the option in the dropdown

That part is same in our issue here

user write a full suggestion in the input without selecting it from the suggestion

@abou-emish
Copy link
Author

@wesleycho wesleycho removed the PRs plz! label Aug 6, 2015
@wesleycho
Copy link
Contributor

Seeing as #3445 is merged, I believe this should no longer be an issue.

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

No branches or pull requests

4 participants