-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[pickers] Support invalid section values to generate aria-valuetext
#19357
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
base: master
Are you sure you want to change the base?
Conversation
Deploy preview: https://deploy-preview-19357--material-ui-x.netlify.app/ Bundle size report
|
I would try the same bug with other adapters. |
Done 👍 |
@@ -244,18 +244,23 @@ function getSectionValueText( | |||
switch (section.type) { | |||
case 'month': { | |||
if (section.contentType === 'digit') { | |||
return adapter.format(adapter.setMonth(adapter.date(), Number(section.value) - 1), 'month'); | |||
const dateWithMonth = adapter.setMonth(adapter.date(), Number(section.value) - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LukasTy I'm not sure what the behavior should be when we try to generate the aria-valuetext
of a value with invalid sections (for example 99
in the day).
Right now the PR removes the property.
Another approach would be to return the raw value of the section but I guess it doesn't add value compared to not setting the property.
aria-valuetext
closes #18799
Before
https://stackblitz.com/edit/react-vcbkkekp?file=Demo.tsx
After
https://stackblitz.com/edit/rf1vfpyp?file=src%2FDemo.tsx