Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning "no onClicked" when button component is used with @type="submit" and no click handler #354

Open
neojp opened this issue Oct 13, 2020 · 1 comment

Comments

@neojp
Copy link
Contributor

neojp commented Oct 13, 2020

Expected Behavior

Do not send a missing this.args.onClicked warning if component is used as button[type=submit].

Actual Behavior

A warning is sent for a missing this.args.onClicked function even if it's not necessary.

if(!this.args.onClicked) {
// eslint-disable-next-line no-console
console.warn(new Error('Button created with no onClicked'));
} else {
this._onClicked = this.args.onClicked;
}

Steps to Reproduce

Add an es-button component with @type=submit and no @onClicked.

<EsButton @type="submit" @label="Search" />

Screenshot

image

@ijlee2
Copy link
Member

ijlee2 commented Oct 13, 2020

For additional context, the error seems to be happening if the <form> element takes a submit event, which allows the user to press Enter to submit the form.

<form {{on "submit" this.submitForm}}>
  <button type="submit">Save</button>
</form>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants