diff --git a/packages/components/select/__tests__/select.test.tsx b/packages/components/select/__tests__/select.test.tsx index 6776344eeb..735a5b38c1 100644 --- a/packages/components/select/__tests__/select.test.tsx +++ b/packages/components/select/__tests__/select.test.tsx @@ -882,3 +882,33 @@ describe("Select with React Hook Form", () => { expect(onSubmit).toHaveBeenCalledTimes(1); }); }); + +describe("validationBehavior=native", () => { + it("should not submit form when required field is empty", async () => { + const onSubmit = jest.fn(); + + const {getByTestId} = render( +
+ + +
, + ); + + const user = userEvent.setup(); + + await user.click(getByTestId("button")); + + expect(onSubmit).toHaveBeenCalledTimes(0); + }); +}); diff --git a/packages/components/select/src/hidden-select.tsx b/packages/components/select/src/hidden-select.tsx index a45197fbff..9d24dd3949 100644 --- a/packages/components/select/src/hidden-select.tsx +++ b/packages/components/select/src/hidden-select.tsx @@ -104,7 +104,6 @@ export function useHiddenSelect( // required: validationBehavior === "native" && isRequired, required: isRequired, disabled: isDisabled, - size: state.collection.size, value: selectionMode === "multiple" ? [...state.selectedKeys].map((k) => String(k))