ant-design: Support Missing `name` prop for ` element in dom when showSearch={false}

I am seeing an <input> element when showSearch={false} as well (video shows) Stackblitz Example: https://stackblitz.com/edit/react-ltsgbj?file=demo.js

https://user-images.githubusercontent.com/6743796/178735079-0bddf898-3843-492a-9909-08a9cd94b350.mp4

<Select> don’t support native name property

Is there a strong reason why we don’t support passing name prop on <Select> like we allow for <Input>?

  • Ant’s <Input> element:

    • ✅ supports name prop; follows standard behavior of HTML (docs)
    • ✅ because name prop is supported, you can wrap regular HTML <form> element around ant design elements
  • Ant’s <Select> element:

    • ❌ supports name prop; follows standard behavior of HTML (docs. For example a regular <select> element supports name
      CleanShot 2022-07-13 at 06 06 02@2x

    • ❌ because name prop is not supported, you cant wrap regular HTML <form> element around ant design elements (if name prop is supported this can be true ✅ )

Although I do care about the HTML standard, its not the motivation for this “bug” report.

The motivation is:

  • I can’t use a regular <form> around <Select> because it doesn’t allow me add a name prop to it.
    • There is no issue with ant’s <Input> which does support name prop which means I can use a regular <form>
  • I can’t use Remix’s <Form> element to do data submission’s because the name property is missing on <Select> element

🤦

@afc163 - can we revisit this? Remix & NextJS rely on the expectation that a select element can have a name prop. The motivation is:

  • we cant use a regular <form> around <Select> because it doesn’t allow me add a name prop to it. There is no issue with ant’s <Input> which does support name prop which means I can use a regular <form>
  • we can’t use Remix’s <Form> element to do data submission’s because the name property is missing on <Select> element this is also standard HTML behavior and I outlined a solution to move forward

Kindly review the initial detailed issues description at the top of the page 🙏

I have the same issue with Remix + Antd and most of the projects I created are stuck on select element or data entry input which does not support native html input. I hope Antd team can solve this problem soon.

Need name for Select

Still No support?

looking for the same… Following

Why not support this? Is there any specific reason? We are using react-hook-form and it validates/controls form elements using the name property. I am pretty sure other form libraries and native form elements also use the name attribute for submission and validation.

So are you not going to support it?

Read more comments on GitHub
← ant-design: <Spin /> error when compiling css
ant-design: Switch: cannot get event object while fire click/change event →