-
Notifications
You must be signed in to change notification settings - Fork 905
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
FormData is updated too late for md-checkbox #5028
Comments
blargh, probably because it's updated asynchronously. As a workaround, you should be able to await the element's updateComplete async function handleChange(event) {
await event.target.updateComplete;
console.log(...new FormData(event.target.form))
} |
Yes, I am looking at the code a bit and see that in the |
… event Fixes #5028 The input event is dispatched before the change event, so we need to update state there instead of on change. PiperOrigin-RevId: 588177488
… event Fixes #5028 The input event is dispatched before the change event, so we need to update state there instead of on change. PiperOrigin-RevId: 588177488
@asyncLiz it seems the fix didn't fix the formdata value when the checkbox is checked which returns |
Are you using |
Nevermind, it was my fault with custom code. Works in latest nightly, by the way. |
What is affected?
Component
Description
When I do:
The example in material-web/docs/intro.md
And I add a oninput or onchange event on the forms like so:
I would expect
When I click the checkbox, the console should display:
(2) ['email', ''] (2) ['subscribe', 'on']
However
It displays
(2) ['email', '']
When I click the checkbox again (turning it off...) the console will now display
(2) ['email', ''] (2) ['subscribe', 'on']
ps.
When I put the same event listener on the form with the html checkbox, I see the expected logs.
Also, the md-radio seemed to work as expected.
Reproduction
code included
Workaround
I have not found a workaround
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
latest
Browser/OS/Node environment
chrome
The text was updated successfully, but these errors were encountered: