CleverCloud / clever-components

Collection of Web Components by Clever Cloud
https://www.clever-cloud.com/doc/clever-components/
Apache License 2.0
215 stars 19 forks source link

fix(cc-input-*): fix Enter keystroke when not into a form element #1099

Closed pdesoyres-cc closed 6 days ago

pdesoyres-cc commented 6 days ago

When the Enter key is typed, we ask for the underlying form to be submitted. It fails when the input is not into a <form> element.

This PR fixes that by requesting a form submit only if a <form> is attached to the input ElementInternals.

How to review

Use Storybook and type Enter in either a cc-input-text, cc-input-date, or cc-input-number. Check for errors in the browser console.

Only 1 reviewer is enough.

github-actions[bot] commented 6 days ago

🔎 A preview has been automatically published : https://clever-components-preview.cellar-c2.services.clever-cloud.com/fix-enter-key-on-inputs/index.html.

This preview will be deleted once this PR is closed.

github-actions[bot] commented 6 days ago

🔎 The preview has been automatically deleted.