adopted-ember-addons / adopted-ember-addons/ember-paper

paper-chips component throws an error while executing inputFocus action

Ouverte
#606 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
879
Forks
327
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

The issue can be reproduced on the demo page containing [paper-chips](http://miguelcobain.github.io/ember-paper/release-1/#/components/chips) examples.

When we fill any value in the 'Default template' example and focus out of the input and then focus back again, an error is thrown:
`Uncaught TypeError: Cannot read property 'close' of undefined`

It seems that this statement is not guarded properly: https://github.com/gpluta/ember-paper/blob/master/addon/components/paper-chips.js#L77

the `autocomplete` param is an object with an 'actions' prop when the `inputFocus` action is called from the `paper-chips-autocomplete` component. Otherwise it is a string containing the value enered in the input.

The if () {} condition should contain a check if the `actions` prop is available on `autocomplete` parameter. It should look like:

```js
if (isPresent(autocomplete) && autocomplete.actions) {
autocomplete.actions.close();
}
```

Can I create a PR for this little fix? Am I missing something important?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.