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

paper-chips component throws an error while executing inputFocus action

Offen
#606 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
879
Forks
327
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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?

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.