Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[InputBase] Suggested attributes of inputProps don't show HTML input attributes #27929

Closed
2 tasks done
mgirondo opened this issue Aug 23, 2021 · 2 comments · Fixed by #27499
Closed
2 tasks done

[InputBase] Suggested attributes of inputProps don't show HTML input attributes #27929

mgirondo opened this issue Aug 23, 2021 · 2 comments · Fixed by #27499
Labels
component: text field This is the name of the generic UI component, not the React module! typescript

Comments

@mgirondo
Copy link

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When trying to get suggestions for the inputProps prop on InputBase, it is not showing HTML Input Attributes, such as maxLength.

However, these props are actually passed to the input element.

Expected Behavior 🤔

It should show the available attributes for input HTML elements, not only global attributes.

Steps to Reproduce 🕹

Steps:

  1. Demo
  2. Start typing on inputProps to get suggestions
  3. Find out only Global Attributes are shown

Context 🔦

I was trying to pass maxLength attribute to inputProps in <InputBase /> and couldn't get it suggested.

Your Environment 🌎

`npx @material-ui/envinfo`
System:
    OS: Windows 10 10.0.19042
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
    Memory: 3.96 GB / 15.37 GB
  Binaries:
    Node: 16.0.0 - C:\Program Files\nodejs\node.EXE
    npm: 7.10.0 - C:\Program Files\nodejs\npm.CMD
  Managers:
    pip3: 20.2.3 - C:\Python39\Scripts\pip3.EXE
  Utilities:
    Git: 2.30.0.
  Virtualization:
    Docker: 20.10.5 - C:\Program Files\Docker\Docker\resources\bin\docker.EXE
  SDKs:
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      Versions: 10.0.17763.0
  IDEs:
    VSCode: 1.59.1 - C:\Users\Martín\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
    Visual Studio: 16.9.31205.134 (Visual Studio Community 2019)
  Languages:
    Bash: 5.0.17 - C:\Windows\system32\bash.EXE
    Python: 3.9.1
  Browsers:
    Edge: Spartan (44.19041.1023.0), Chromium (92.0.902.78)
    Internet Explorer: 11.0.19041.906
  Monorepos:
    Lerna: 3.22.1
@mgirondo mgirondo added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 23, 2021
@mgirondo
Copy link
Author

mgirondo commented Aug 23, 2021

Is there any reason to have InputBaseComponentProps interface extending React.HTMLAttributes and not React.InputHTMLAttributes on InputBase.d.ts?

@michaldudak michaldudak added component: text field This is the name of the generic UI component, not the React module! typescript and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 24, 2021
@michaldudak
Copy link
Member

The InputBaseComponentProps effectively accepts React.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement> & Record<string, any> meaning you can basically put there almost any object, but at the cost of having exact suggestions. We are discussing the approach for typing inner components' props in #27499

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants