required id property in DateInput, SingleDatePicker, SingleDatePickerInput
See original GitHub issueHi,
DateInput, SingleDatePicker and SingleDatePickerInput has id
property, which is required.
I cannot see why it is done as mandatory field.
Is it done on purpose or the field can be optional?
See src/components/DateInput.jsx#L7
and
<input
id={id}
name={id}
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
required id property in DateInput, SingleDatePicker ... - GitHub
Hi, DateInput, SingleDatePicker and SingleDatePickerInput has id property, which is required. I cannot see why it is done as mandatory field ...
Read more >Javascript airbnb react-dates showClearDate throwing
I have a similar issue. I get the same error "SingleDatePickerInput.js:236 Uncaught TypeError: Cannot read property 'onClearDateMouseEnter' ...
Read more >Documentation: <amp-date-picker> - amp.dev
Provides a widget to select dates. The date picker can render as an overlay relative to input fields, or as a static calendar...
Read more >DateInput - Grommet
Any properties to pass on to the underlying DropButton when not inline and no format. ... id. The id of the input. string....
Read more >react-dates - CodePen
<p class="screen-reader-only" id="DateInput__screen-reader-message-date_input">Press the down arrow key to interact with the calendar and select a date.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s done on purpose. For accessibility, all inputs must be both wrapped in a
<label>
that it is also linked to withid
/htmlFor
. IDs must be unique on the page, so a reusable component can’t safely generate them. Typically, you’d want to pass them down from the server, since that’s the only place you know for sure a component is only being used once on the page.(also for accessibility, inputs shouldn’t be used outside of forms)
Employees require a11y affordances just the same as end users - the legal requirements are often stronger for employees, in fact. The HTML standard doesn’t require a lot of things, but that’s not the authority on UI.