BrightspaceUI / text-input

Polymer-based web component for D2L text inputs
http://ui.developers.brightspace.com
Apache License 2.0
0 stars 5 forks source link

allow not submitting of form on pressing enter within input field #14

Closed mdulat closed 6 years ago

mdulat commented 6 years ago

Required for https://github.com/Brightspace/d2l-rubric/pull/106

mdulat commented 6 years ago

@dlockhart @awikkerink it isn't clear to me why this build is failing, looks like it timed out. Something I need to investigate, or is it just because this is a fork?

awikkerink commented 6 years ago

What is the case this change is trying to address?

mdulat commented 6 years ago

This allows a user of the component to indicate that form submission should not happen when a user presses Enter within the input field.

mdulat commented 6 years ago

Currently in our rubrics Edit views, which live within a form, we are using this component, and when the user presses Enter, the form is submitted. We would like for no action to occur in this case.

awikkerink commented 6 years ago

Why not catch the events in rubrics? Something like

<form id="form" on-submit="_preventSubmitHandler">
...
<input type="submit" on-click="_submitForm">
</form>
_submitForm: function() {
    this.form.submit();
}

This would also prevent other elements from submitting the form.

mdulat commented 6 years ago

The form isn't within our component (d2l-rubric), it's within the LMS which houses our component, so we don't want to modify it directly.

mdulat commented 6 years ago

Yes probably for types that automatically submit. For rubrics we also have textareas, but they don't submit the form on Enter. I don't have permissions to merge to this repo. If you're ok with it, can you merge it?