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

paper-chips component throws an error while executing inputFocus action

未关闭
#606 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
879
派生
327
PR 合并指标
30 天内没有已合并 PR

描述

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?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。