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 摘要。