Skip to content

fix: prevent Enter from submitting MUI forms using uicore MuiForm - #1145

Open
santipalenque wants to merge 3 commits into
masterfrom
fix/prevent-enter-submit-form
Open

santipalenque wants to merge 3 commits into
masterfrom
fix/prevent-enter-submit-form

Conversation

@santipalenque

@santipalenque santipalenque commented Nov 2, 2026 •

Copy link
Copy Markdown

ref: https://app.clickup.com/t/9014802374/86bcwj81y

Summary by CodeRabbit

Summary

  • Maintenance
    • Updated the shared UI foundation package.
    • Standardized forms across the app while preserving existing fields, validation, and submission behavior.
  • Bug Fixes
    • Improved alignment of cart total rows across different cart states.
  • Tests
    • Updated checks for refund submission and row actions. Refund tests verify click-based submission and that pressing Enter does not submit.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The openstack-uicore-foundation dependency changes to 5.0.72-beta.1. Components and pages replace MUI Box form wrappers with MuiForm. Most Formik handlers and form attributes remain. RefundForm tests now submit by clicking the button and check that Enter does not submit.

Changes: MuiForm migration

Layer / File(s) Summary
Replace Box form wrappers
package.json, src/components/filters/*, src/components/forms/*, src/components/mui/*, src/pages/*
The foundation dependency changes to 5.0.72-beta.1. Forms across components and pages use MuiForm in place of Box-based wrappers. Existing Formik handlers and form attributes are retained in most forms. SaveViewDialog removes its explicit submit handler. RefundForm tests switch to button clicks, add a check that Enter does not submit, and retain success and failure assertions.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • fntechgit/summit-admin#1072: This PR converts the email-flow event page to a Formik-based component, and this change updates the form wrapper in that same page.

Suggested reviewers: tomrndom, smarcet, ako3131

Merge Risk: Minimal · up to 11087

This change stops Enter from submitting forms by switching them to the shared form wrapper, and it updates tests to match the row-actions menus. No concrete defects remain after review, so it looks ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a fix that stops Enter from submitting MUI forms by switching the form wrapper to the uicore MuiForm component. The raw summary shows many forms moved from a MUI Box c…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a fix that stops Enter from submitting MUI forms by switching the form wrapper to the uicore MuiForm component. The raw summary shows many forms moved from a MUI Box configured as a form to MuiForm, and the RefundForm test and comment changes match the Enter-key behavior named in the title. The title is short, specific, and uses a conventional commit prefix.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 62d9bb8f-c4ac-46d4-8390-0bc92d9b48fc
Commits

Reviewing files that changed from the base of the PR and between dfe270c and 110876f.

Files selected for processing: 5

  • src/pages/sponsors/show-pages-list-page/__tests__/show-pages-list-page.test.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/__tests__/cart-view.test.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/cart-view.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/__tests__/sponsor-forms-tab.test.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/__tests__/sponsor-pages-tab.test.js

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread package.json Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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-foundation to 5.0.72-beta.1.
  • Replaces MUI Box form wrappers with MuiForm, 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

@smarcet
smarcet requested a review from caseylocker November 11, 2026 02:45
Comment thread package.json Resolved
noValidate
autoComplete="off"
>
<MuiForm onSubmit={formik.handleSubmit} noValidate autoComplete="off">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarcet smarcet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santipalenque please review

@santipalenque
santipalenque force-pushed the fix/prevent-enter-submit-form branch from 2322071 to dfe270c Compare November 11, 2026 18:47

@caseylocker caseylocker left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two blockers, both from the uicore bump to 5.0.74. Details inline.

  1. Jest is red: 12 tests in 4 suites fail because 5.0.74 moves row Edit/Delete into an actions menu.
  2. 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:104 uses MuiForm now, and there is no component="form" left in src.
  • Form-patterns rule doesn't mention MuiForm (smarcet): still open. .claude is 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:66 has onSubmit={formik.handleSubmit} again.
  • IME composition (CodeRabbit): still there. MuiForm in 5.0.74 has no isComposing check. 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.

Comment thread package.json Resolved
Comment thread package.json Resolved

@romanetar romanetar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

6 participants