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

Select does not propagate change event #6217

Open
gijsroge opened this issue Apr 17, 2024 · 7 comments · May be fixed by #6320
Open

Select does not propagate change event #6217

gijsroge opened this issue Apr 17, 2024 · 7 comments · May be fixed by #6320
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@gijsroge
Copy link

gijsroge commented Apr 17, 2024

Provide a general summary of the issue here

When you change a value in a Select element there is no change event that bubbles causing patterns like <form onChange> to stop working.

🤔 Expected Behavior?

The select should trigger a change event like normal form elements.

😯 Current Behavior

The <Select> element does not behave like a native <select> element by not bubbling change events.

💁 Possible Solution

I believe the reason why this currently does not work is because the select just get's re-rendered. Maybe adding a manual change event in the <HiddenSelect> would solve this.

🔦 Context

No response

🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/twilight-voice-tjmwcl?file=%2Fsrc%2FApp.js%3A4%2C9

Version

1.0.0-rc.0

What browsers are you seeing the problem on?

Firefox, Chrome, Safari, Microsoft Edge

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@snowystinger snowystinger added the bug Something isn't working label Apr 17, 2024
@snowystinger
Copy link
Member

Thanks for the issue and initial digging, I think your solution could work.

@snowystinger snowystinger added the good first issue Good for newcomers label Apr 17, 2024
@gijsroge
Copy link
Author

@snowystinger i've already patched this in my project, I could start a PR if you want.

@gijsroge gijsroge linked a pull request May 2, 2024 that will close this issue
5 tasks
@joshuajaco
Copy link
Contributor

We are having the same issue with other form elements including Checkbox, Combobox and RadioGroup.
Not sure if this has the same root cause or is a separate issue.

@joshuajaco
Copy link
Contributor

This one also seems to be the same issue: #5955

@joshuajaco
Copy link
Contributor

joshuajaco commented Jul 2, 2024

@snowystinger
Copy link
Member

Checkbox/Radio is probably a different issue, looks like we stop propagation on both of those, https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/toggle/src/useToggle.ts#L56

@RickHuizing01
Copy link

Hey!

I wanted to add that my team is also experiencing this issue. As a temporary measure, we have "hacked" a workaround in our codebase that submits a native onChange event. However, we are looking forward to a more permanent fix. It seems like we are experiencing similar issues with our checkboxes but I will do some extra research into them to make sure it is not a bug on our side.

Could you provide an update on the status of this issue? Thanks in advance 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants