reactpy
reactpy copied to clipboard
`event["target"]["checked"]` does not exist for checkbox inputs
Current Situation
In ReactJS, event.target.checked would exist for checkboxes. However, this does not appear to be the case for ReactPy.
See the example in the docs for a scenario that should have worked.
Proposed Actions
Determine why our client side event handler isn't propagating the entire target context to the server.
I think that can be fixed right here by adding checked: element.checked.
@rmorshea Is there a chance there's a better way of doing this? I'm not seeing anywhere within preact's source code where they statically define event contents like this.
BUTTON: (element: HTMLInputElement) => ({ value: element.value, checked: element.checked }),
I found that when adding checked: element.checked, a TypeScript error appears stating that "Property 'checked' does not exist on type 'HTMLButtonElement', may need to find another workaround.
Proposed change:
INPUT: (element: HTMLInputElement) => ({ value: element.value, checked: element.checked })
Since the issue is referred to the checkboxes needing a checked attribute, I believe this may fix it here.
That seems correct to me.