Repository navigation
fix: prevent Enter from submitting MUI forms using uicore MuiForm - #1145
santipalenque wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🔵 Needs a closer look
Enter-key handling across 41 migrated forms depends on an unavailable beta dependency, requiring human browser validation of multiline editing, autocomplete selection, and mouse and keyboard activation of Save.
No open issues 🎉
What changed in this PR
This PR adopts the shared uicore MuiForm across admin forms to prevent accidental submission when Enter is pressed in an input.
Changes:
- Updates
openstack-uicore-foundationto5.0.72-beta.1. - Replaces MUI
Boxform wrappers withMuiForm, retaining existing fields and form settings. - Updates refund tests to check Enter suppression and click-based submission.
| File | Description |
|---|---|
yarn.lock |
Locks the updated uicore dependency. |
src/pages/track_chairs/components/track-chair-dialog.js |
Adopts MuiForm for track chairs. |
src/pages/tags/tags-popup.js |
Adopts MuiForm for tags. |
src/pages/summitdocs/edit-summitdoc-page.js |
Adopts MuiForm for summit documents. |
src/pages/sponsorship-types/components/sponsorship-dialog.js |
Adopts MuiForm for sponsorship types. |
src/pages/sponsors/sponsor-users-list-page/components/sponsor-global-new-user-popup.js |
Adopts MuiForm for sponsor invitations. |
src/pages/sponsors/sponsor-users-list-page/components/process-request-form.js |
Adopts MuiForm for processing requests. |
src/pages/sponsors/sponsor-users-list-page/components/edit-user-popup/sponsor-user-form.js |
Adopts MuiForm for sponsor-user editing. |
src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/sponsor-user-form.js |
Adopts MuiForm for per-sponsor user editing. |
src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/new-user-popup.js |
Adopts MuiForm for per-sponsor invitations. |
src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.js |
Adopts MuiForm for adding page templates. |
src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/manage-tier-addons-popup.js |
Adopts MuiForm for tier add-ons. |
src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.js |
Adopts MuiForm for adding tiers. |
src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-extra-question-popup.js |
Adopts MuiForm for extra questions. |
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form.js |
Adopts MuiForm for customized forms. |
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/add-sponsor-form-template-popup/index.js |
Adopts MuiForm for adding form templates. |
src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/edit-form/index.js |
Adopts MuiForm for cart form editing. |
src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/client-form/index.js |
Adopts MuiForm for cart client details. |
src/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/edit-badge-scan-popup.js |
Adopts MuiForm for badge-scan editing. |
src/pages/sponsors/sponsor-forms-list-page/components/form-template/form-template-form.js |
Adopts MuiForm for sponsor form templates. |
src/pages/sponsors/popup/edit-tier-popup.js |
Adopts MuiForm for tier editing. |
src/pages/sponsors/popup/add-sponsor-popup.js |
Adopts MuiForm for adding sponsors. |
src/pages/sponsors-global/page-templates/page-template-popup/index.js |
Adopts MuiForm for global page templates. |
src/pages/sponsors-global/form-templates/sponsor-inventory-popup.js |
Adopts MuiForm for inventory items. |
src/pages/sponsors-global/form-templates/form-template-popup.js |
Adopts MuiForm for global form templates. |
src/pages/sponsors-global/add-on-types/add-on-types-dialog.js |
Adopts MuiForm for add-on types. |
src/pages/media_file_types/components/media-file-type-dialog.js |
Adopts MuiForm for media file types. |
src/pages/marketing/edit-marketing-setting-page.js |
Adopts MuiForm for marketing settings. |
src/pages/events/components/event-type-dialog.js |
Adopts MuiForm, preserving the event form ID. |
src/pages/email_flow_events/edit-email-flow-event-page.js |
Adopts MuiForm for email-flow events. |
src/pages/companies/edit-company-page.js |
Adopts MuiForm for company editing. |
src/components/mui/RefundForm/index.jsx |
Adopts MuiForm; updates the concurrent-submission comment. |
src/components/mui/RefundForm/__tests__/refund-form.test.js |
Checks Enter suppression and click-based refund submission. |
src/components/mui/mui-qr-badge-popup.js |
Adopts MuiForm for QR badge editing. |
src/components/mui/ClientCard/components/EditClientDialog.jsx |
Adopts MuiForm for client editing. |
src/components/mui/ClientCard/components/EditAddressDialog.jsx |
Adopts MuiForm for address editing. |
src/components/forms/tax-type-form.js |
Adopts MuiForm for tax types. |
src/components/forms/sponsor-settings-form/index.js |
Adopts MuiForm, preserving wrapper styling. |
src/components/forms/selection-plan-form.js |
Adopts MuiForm, preserving form ID and class. |
src/components/forms/media-upload-form.js |
Adopts MuiForm, preserving the media form ID. |
src/components/forms/event-category-form.js |
Adopts MuiForm for event categories. |
src/components/forms/admin-access-form.js |
Adopts MuiForm, preserving full-width styling. |
src/components/filters/saved-views/components/save-view-dialog/index.js |
Adopts MuiForm and removes the Enter-submit handler. |
package.json |
Selects uicore 5.0.72-beta.1. |
Review effort: Balanced
| noValidate | ||
| autoComplete="off" | ||
| > | ||
| <MuiForm onSubmit={formik.handleSubmit} noValidate autoComplete="off"> |
There was a problem hiding this comment.
@santipalenque The MuiForm convention introduced here is not recorded in the form-patterns rule, so new forms will keep being written without it.
.claude/rules/summit-admin-form-patterns.md ("Modern: Formik + MUI") still shows Formik's <Form> as the template for new forms and does not mention MuiForm. After this PR no form in src uses <Form>, and every MUI form is expected to go through MuiForm, but nothing tells the next author that. A form written from the documented template submits on Enter again.
Suggested fix: update the modern example in that rule to the pattern this PR applies:
import { FormikProvider, useFormik } from "formik";
import MuiForm from "openstack-uicore-foundation/lib/components/mui/form";
<FormikProvider value={formik}>
<MuiForm onSubmit={formik.handleSubmit} noValidate autoComplete="off">
<MuiFormikTextField name="name" label="Name" required />
</MuiForm>
</FormikProvider>
and add one line stating that MUI forms use MuiForm instead of Box component="form" so Enter never submits implicitly.
There was a problem hiding this comment.
added rule here, please review @smarcet : https://github.com/fntechgit/ftn-docsnsklz/pull/188
2322071 to
dfe270c
Compare
caseylocker
left a comment
There was a problem hiding this comment.
Two blockers, both from the uicore bump to 5.0.74. Details inline.
- Jest is red: 12 tests in 4 suites fail because 5.0.74 moves row Edit/Delete into an actions menu.
- The editable cart total row is one cell too wide, for the same reason.
The earlier reviews were against 2322071 on 5.0.72-beta.1, so none of them saw the bump. I rechecked their points at dfe270c:
- Badge feature form still submitting on Enter (smarcet): fixed.
edit-badge-feature-page.js:104usesMuiFormnow, and there is nocomponent="form"left insrc. - Form-patterns rule doesn't mention
MuiForm(smarcet): still open..claudeis gitignored here (.gitignore:15), so that rule file can't ship in this PR. It has to be updated where the rule is maintained. - Save-view dialog missing the native submit handler (CodeRabbit): fixed.
save-view-dialog/index.js:66hasonSubmit={formik.handleSubmit}again. - IME composition (CodeRabbit): still there.
MuiFormin 5.0.74 has noisComposingcheck. That's a uicore fix, not a summit-admin one, and I haven't tested it in a browser.
One more thing: the bump changes every table with onEdit/onDelete from one-click icons to a menu, app wide. Worth a line in the PR description so reviewers know to test it.
… deleted responsive options
ref: https://app.clickup.com/t/9014802374/86bcwj81y
Summary by CodeRabbit
Summary