miguelcobain / ember-paper

The Ember approach to Material Design.
http://miguelcobain.github.io/ember-paper
MIT License
889 stars 331 forks source link

paper-chips inside paper-form: form is sent and closed when adding new tag (press Enter) #1177

Open alexander-e1off opened 3 years ago

alexander-e1off commented 3 years ago

ember-paper version 1.0.0-beta.35.

When use chips inside a form:

<PaperForm @onSubmit={{action "basicSubmitAction"}} as |form|>
  ...

 <PaperChips @content={{this.content}}  @removeItem={{action "removeItem"}} @addItem={{action "addItem"}} @placeholder="Add a tag" />

  <div class="layout-row">
    <form.submit-button @raised={{true}} @primary={{true}}>Submit</form.submit-button>
  </div>
</PaperForm>

After entering new tag and pressing Enter button, form is sent and closed.

It is expected behavior for other components, e.g. input, but for chips I expect that new tag is added and form is not closed.

As a simple workaround I wrapped chips into div:

<div onkeydown="if (event.keyCode == 13) {return false;}">
  <PaperChips @content={{this.content}}  @removeItem={{action "removeItem"}} @addItem={{action "addItem"}} @placeholder="Add a tag" />
</div>

Is there better solution to solve this issue?