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

Make Input id as required (in TS typings) #51

Open
JForsaken opened this issue Nov 25, 2019 · 1 comment
Open

Make Input id as required (in TS typings) #51

JForsaken opened this issue Nov 25, 2019 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@JForsaken
Copy link

JForsaken commented Nov 25, 2019

Description

The id for an Input should probably be marked as required by it's TS typings. If not, its label will not have labelFor set.

Expected behavior

Spit out a TS error when id is not present.

Actual behavior

Not having an id is not flagged as an error, while the docs state that id should be set.

image

Steps to reproduce the problem

  1. Create an Input and don't set the id prop
  2. No TS errors/warnings

Specifications

  • Affected component(s): Input
  • Versions: latest
@xdrdak
Copy link
Contributor

xdrdak commented Nov 25, 2019

Hmm, technically speaking, you don't actually ever need to add an id to an Input. Just like a native HTML input element will not trigger any warnings for lack of the id prop.

Probably the documentation should be worded better. It should perhaps read:

Inputs should have a unique ID prop whenever the label prop is being used.

The behaviour of Input is to automatically inject a pre-formatted label should the label prop be applied.

@glambert glambert added the documentation Improvements or additions to documentation label Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants