Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular directive name conflicts with autocomplete="off" #136

Closed
brandonpassley opened this issue Dec 20, 2016 · 2 comments · Fixed by #138
Closed

Angular directive name conflicts with autocomplete="off" #136

brandonpassley opened this issue Dec 20, 2016 · 2 comments · Fixed by #138

Comments

@brandonpassley
Copy link

Bug 🐞

The Angular directive name conflicts with the HTML autocomplete attribute. When using autocomplete="off" on an input on the same page as the Algolia autocomplete directive, the directive converts the input into an Algolia autocomplete input.

@rayrutjes
Copy link
Member

@jerskouille can this be solved with the noConflict method recently introduced? #134

@Jerska
Copy link
Member

Jerska commented Dec 22, 2016

Unfortunately no. This was a bold move on our end to take an actual HTML attribute as a directive name. This is definitely a bug, but I think it is easily resolvable.
According to MDN, autocomplete itself as an attribute does nothing. It expects a string value.

We're not expecting any value to be passed through the autocomplete attribute, so we can simply check for that.

We also need to take into account that the directive is restricted on Attribute & Class, so for instance:

<input class="autocomplete" autocomplete="off" />

should still be using autocomplete.js.

So in the end, I think we can continue the linking function only

if (element.hasClass('autocomplete') || attrs.autocomplete === '') {
  // ...
}

here to prevent this.

However, funnily enough, I think we're actually setting autocomplete to off afterwards. Definitely confusing.

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

Successfully merging a pull request may close this issue.

3 participants