fix: fixed checkbox check on label click#2633
fix: fixed checkbox check on label click#2633waaseyzulfiqar wants to merge 2 commits intomaproulette:mainfrom
Conversation
|
Can you share the code from the browser inspector that this creates? I am concerned that this will create duplicate label tags because OriginalCheckboxWidget (which is https://github.com/rjsf-team/react-jsonschema-form/blob/573980dbf91f9891905c7d3612359c2c90c53ee3/packages/chakra-ui/src/CheckboxWidget/CheckboxWidget.tsx#L64C8-L75 already has label property which should only be hidden when null according to https://github.com/rjsf-team/react-jsonschema-form/blob/573980dbf91f9891905c7d3612359c2c90c53ee3/packages/chakra-ui/src/components/ui/checkbox.tsx#L25 |
|
I've made the change and updated the code to pass label={null} to OriginalCheckboxWidget instead of an empty string. This should prevent the widget from rendering its own label and avoid any duplicate elements in the DOM. I’m currently unable to run the app locally to test it fully, but the change is pushed — could you please have a look and let me know if it works as expected? |
|
I'm not sure if it's helpful to chime in here, but I've been looking forward all week to taking my new dev env for a spin on this PR. On my machine and with this PR I'm seeing an error on the consent form: seemingly from line 180: This approach in this PR is very similar to how I would have tried solving this ticket. With more review, however, I see a few issues that I'll share:
In investigating the errors, and trying to understand the rendering mechanics at play, I worked up a solution that tackles these problems and succeeds without the id/htmlFor. It feels weird to toss another option into the mix, but figured I'd share that the approach works and might be an alternative option. |
|
For reference, here's the alternative approach |
I'm a fan of this approach. If you agree @waaseyzulfiqar, could you implement this change or let @jlewin know to make a new pr linked to this one? |
|
Closing for now as stale. I will make sure to link this pr to help someone who wants a good first issue to work on. |



No description provided.