material-ui: [TextField][material-ui] id is missing in select TextField's input element

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce ๐Ÿ•น

Link to live example:

https://stackblitz.com/edit/stackblitz-starters-bzhhl2?file=src%2FApp.tsx

Steps:

  1. Create a TextField component with the select property as true

Current behavior ๐Ÿ˜ฏ

<input> element is missing the id used in the <label>'s for attribute. image

Expected behavior ๐Ÿค”

id is present in the <input>.

Context ๐Ÿ”ฆ

No response

Your environment ๐ŸŒŽ

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 2
  • Comments: 25 (15 by maintainers)

Most upvoted comments

@mj12albert Yes, Iโ€™ll start working on it.

InputLabelProps={{ htmlFor: 'element-id' }} inputProps={{ id: 'element-id }}

I donโ€™t know the history of it. It seems weird for the label to reference a div in its for attribute. I suppose we could generate an id of the input and associate it with the label. I would not remove or change the id on the div itself, though.