-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[fields] Implement empty visual state #8069
Conversation
Netlify deploy previewNetlify deploy preview: https://deploy-preview-8069--material-ui-x.netlify.app/ Updated pagesNo updates. These are the results for the performance tests:
|
packages/x-date-pickers/src/internals/hooks/useField/useField.ts
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/useField/useFieldState.ts
Outdated
Show resolved
Hide resolved
@joserodolfofreitas You might also be interested to take a look at this change. 🤔 |
expectInputValue(input, 'MM / DD / YYYY'); | ||
|
||
input.setSelectionRange(9, 11); |
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.
Was this a mistake previously, that somehow did not fail the test? 🤔 🤷
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 think @oliviertassinari wrote the initial version of this test
We try to mimic a touch focus interaction, but I did not check what was the correct execution order of the events.
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.
Correct, this test comes from #6207.
It seems that this test caught a regression, changing the test hides the bug. See how on https://deploy-preview-8069--material-ui-x.netlify.app/x/react-date-pickers/fields/#fields-to-edit-a-single-element, now I need to tap twice to select the year:
20230305-002805-333.mp4
One tap is enough on https://next.mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element.
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.
This behavior change is intended. It was a trade off between having a placeholder and being able to pick a section in a non focused input in a single click.
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.
Ah, OK, so using the <input>
placeholder
attribute over applying the placeholder color. This sounds simpler for developers when they provide a custom textbox.
I tested it quickly, it looks great ! 🥳 Do you think we could avoid the "focus all" flickering ? Screencast.2023-02-28.16.28.41.mp4 |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Thanks for bringing it up! 👍 |
Seems to do the trick indeed 👍 |
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.
Feels much better now! Thanks for tackling this before the stable release!
Great design improvement! I have updated the PR's description so developers can more easily understand what this is about. |
Fix #4592
Doc preview: https://deploy-preview-8069--material-ui-x.netlify.app/x/react-date-pickers/fields/
Change empty fields value behavior:
placeholder
instead ofvalue
when no value is present andfield
is not focusedvalue
whenfield
is focused or value existsBefore
After