-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Support empty sections #10307
Conversation
Deploy preview: https://deploy-preview-10307--material-ui-x.netlify.app/ |
dbe2ea0
to
603ba80
Compare
603ba80
to
750dd2a
Compare
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 looks like an interesting/niche addition, but it could prove useful in certain scenarios.
It does not seem to cause too much headache code-wise, hence, I'm not against introducing it. 👌
I've explored a solution along the lines of the issue authors case and it seems to work well.
The only issue I could see is that after the value is set and you try to change it using the keyboard - the value get's reset.
Have you explored the option of having such support when selectedSections
is undefined
or null
, it could avoid the extra head-ache of having an empty
section. 🤔
In your example I can't edit the value, it's throws invalid dates, not sure why.
For me the problem is that if we have 0 section (which is the case before this PR), then the whole escaped format is not put in any section as a start or end separator (which is the only way I see to render it). |
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.
In your example I can't edit the value, it's throws invalid dates, not sure why.
With which editing are you having problems?
You can easily edit with the picker and I expect that this is the behavior the issue author is expecting.
The main question is—how do we handle certain editing actions when an empty
section is selected?
Should we simply disallow all the actions and call it a day? 🤔 😆
Screencast.2023-09-14.14.16.23.mp4 |
My guess was that this is something that the issue author expected as a final result. 🤔 Screen.Recording.2023-09-14.at.15.29.40.mov |
I'd be surprised. |
It's not fine if you try modifying the value in any way (i.e. Arrows).
It wasn't the best and most clear example. I've replaced the empty format in the mentioned demo from an incorrect |
I think this matches exactly what I am building internally |
Closing because the user-land fix proposed by @LukasTy works well |
@flaviendelangle my suggested example is based on the changes in this PR, without them such behavior doesn't work. |
Oh sorry 😬 |
Possibly. Didn't try going the removal route and checking what would be the minimal working scenario, but the example basically relies on the |
I'll re-open a PR then 👍 |
Test added |
c1becc5
to
ca76bc9
Compare
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 addition LGTM. 👍
We could consider adding a demo about such usage, but on the other hand, it can be done when we see at least a second request for something like this, because the situation that needs this seems quite niche. 🤔
I agree that we can wait a little before adding a doc example 👍 |
Explore #10279
@LukasTy I would like to have your opinion on this one.
It's clearly pretty niche.
If we want to support it, I'll add some tests.