sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Unable to clear radio fields once set using UI

Open coreyward opened this issue 3 years ago • 2 comments

Describe the bug

There is no way to clear radio fields. This causes issues when trying to clear out a nested object to make it empty, and thus have it removed. This is adjacent to #2630, which was mostly resolved in #2718.

To Reproduce

Steps to reproduce the behavior:

  1. Select a value for a radio field nested in an optional object field
  2. There is no way to clear the radio

Expected behavior

Perhaps a “clear” or “x” button to unset the value?

coreyward avatar Jan 27 '22 17:01 coreyward

I second what @coreyward says above, this makes it impossible to have optional objects with nested radio fields because as soon as you select something in that field there is no way to clear it (and delete the parent object).

As for how to improve the situation, I think @coreyward suggested good ideas, but a short term very simple solution may be to just allow clicking the selected radio field to unselect it (see http://jsfiddle.net/sparky672/KdZG7/).

fvieira avatar Jul 10 '22 20:07 fvieira

Although I haven't had this happen to me or tested this, I just thought a boolean field might have the exact same problem as mentioned above since there is no way to clear it either. So while my short term solution above may be worthwhile, @coreyward solutions may be used for both types of fields.

fvieira avatar Jul 10 '22 20:07 fvieira

Hi!

We are currently working on improving our workflows and follow-up on our open GitHub repository. In that work, we have decided to close most issues older than the release of Sanity Studio v3.

We value your feedback, so if this issue is still important to you and relevant for Sanity Studio v3, please search for relevant open issues. If you can’t find any, open a new one and link to relevant comments in this thread. For questions about how to do something, please post them in the slack community.

kmelve avatar Jan 11 '23 20:01 kmelve