Skip to content
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

event["target"]["checked"] does not exist for checkbox inputs #1070

Open
Archmonger opened this issue Jun 19, 2023 · 5 comments
Open

event["target"]["checked"] does not exist for checkbox inputs #1070

Archmonger opened this issue Jun 19, 2023 · 5 comments
Labels
flag-good-first-issue A well defined and self-contained task. priority-1-high Should be resolved ASAP. type-bug About something that isn't working type-javascript Related to client-side code

Comments

@Archmonger
Copy link
Contributor

Archmonger commented Jun 19, 2023

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.

@Archmonger Archmonger added type-bug About something that isn't working priority-1-high Should be resolved ASAP. type-javascript Related to client-side code labels Jun 19, 2023
@rmorshea
Copy link
Collaborator

I think that can be fixed right here by adding checked: element.checked.

@rmorshea rmorshea added the flag-good-first-issue A well defined and self-contained task. label Jun 19, 2023
@Archmonger
Copy link
Contributor Author

Archmonger commented Jun 19, 2023

@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.

@DennisHC
Copy link

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.

@DennisHC
Copy link

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.

@rmorshea
Copy link
Collaborator

That seems correct to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag-good-first-issue A well defined and self-contained task. priority-1-high Should be resolved ASAP. type-bug About something that isn't working type-javascript Related to client-side code
Projects
None yet
Development

No branches or pull requests

3 participants