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

React: Pressing enter in a form input fails to submit the form #166

Open
3 of 6 tasks
ashleyryan opened this issue Sep 8, 2022 · 2 comments
Open
3 of 6 tasks

React: Pressing enter in a form input fails to submit the form #166

ashleyryan opened this issue Sep 8, 2022 · 2 comments

Comments

@ashleyryan
Copy link
Contributor

Describe the bug

When using a plain input type="submit", hitting enter in a form field submits the form. When using a cds-button with type="submit", it does not.

How to reproduce

I believe this is a react only issue, as the form is submitted with a plain web component

react: https://stackblitz.com/edit/clarity-react-demo-wkfrre?file=src%2FApp.tsx
vanilla js: https://stackblitz.com/edit/clarity-react-demo-wkfrre?file=src/App.tsx

Steps to reproduce the behavior:

  1. Focus in an input element
  2. Click enter
  3. Note that the on submit event is not called

Expected behavior

The form should submit

Versions

Clarity Core version:

  • v5.x
  • v6.x

Framework:

  • Angular
  • React
  • Vue
  • Other:
@ashleyryan ashleyryan changed the title React: Pressing enter on a form input fails to submit the form React: Pressing enter in a form input fails to submit the form Sep 8, 2022
@ghillert
Copy link

ghillert commented Nov 8, 2022

I am observing the same issue in an Angular app.

This works: <button type="submit">Submit</button>
This does not: <cds-button type="submit">Login</cds-button>

I wonder if I miss something obvious here are as this is rather basic behavior.

@grahamford
Copy link

This looks like a regression as it was previously fixed here vmware-archive/clarity#6263 but the code in button.base.ts has changed significantly since that.

If it's any help, I've a Stackblitz of an Angular demo https://stackblitz.com/edit/cds-button-submit?file=src/app/app.component.ts

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

No branches or pull requests

3 participants