-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[docs] New recipe of a read-only field #14606
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
Conversation
docs/data/date-pickers/custom-field/CustomReadonlyBehaviorMaterialTextField.tsx
Outdated
Show resolved
Hide resolved
845e945 to
c7a1032
Compare
c7e9186 to
e668ed2
Compare
e668ed2 to
00c6329
Compare
26a8775 to
15fbfec
Compare
packages/x-date-pickers/src/internals/hooks/usePicker/usePickerValue.types.ts
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/usePicker/usePickerValue.ts
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/usePicker/usePickerValue.ts
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/usePicker/usePicker.ts
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/components/PickersProvider.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/components/PickersProvider.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/components/PickersProvider.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/components/PickersProvider.tsx
Outdated
Show resolved
Hide resolved
1772912 to
0c81dda
Compare
0c81dda to
07a0285
Compare
LukasTy
left a comment
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.
Awesome work! 👏 💯
Leaving the final round of nitpicks. 🙈 😆
packages/x-date-pickers/src/internals/hooks/useField/buildSectionsFromFormat.ts
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/components/PickersProvider.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/components/PickersProvider.tsx
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/usePicker/usePicker.ts
Outdated
Show resolved
Hide resolved
docs/data/date-pickers/custom-field/custom-behavior/ReadOnlyMaterialTextField.tsx
Outdated
Show resolved
Hide resolved
…er.tsx Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
…er.tsx Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
…r.ts Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
68c41e9 to
018158d
Compare
| InputProps={{ | ||
| ...InputProps, | ||
| readOnly: true, | ||
| endAdornment: <CalendarIcon color="action" />, |
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.
I'm not sure we should have done this. 🙈
Now the keyboard navigation and a11y is borked. 🤷
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.
The Tab sequence looks good to me, it does not focus the adornment anymore
I don't have the aria label on the TextField though, should probably add that (could be a nice addition in the context)
Closes #12342
Demo preview
It's a good opportunity to have a look at the overall DX of the most basic custom-behavior field possible.
In this PR
useFieldPlaceholderto generate the placeholder based on the formatPickersFieldContextand a public hookusePickersFieldContextto pass information from the picker to the field without impacting the props (only one prop for now to open the field, name under discussion)custom-behaviorfolder (I will move the button and the autocomplete demos there once refined)Follow up
useValidation,useFieldPlaceholder,usePickersFieldContextanduseSplitFieldPropsusePickersFieldContextinstead of drilling them down (would be breaking changes for v8).