Skip to content

Ensure both onchange and oninput callbacks are executes when typing #3562

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

Merged
merged 9 commits into from
Jun 14, 2022

Conversation

marconi1992
Copy link
Contributor

@marconi1992 marconi1992 commented Jun 12, 2022

Since this change the onChange prop gets normalized to oninput but this is overwritten if we include the onInput prop, being only triggered the last one defined.

<input onChange={onChange} onInput={onInput} />

FWIW it's impossible to prevent this prop from being overwritten because we're using it as an object key. In this case, we mimic the React behavior by combing both callbacks in only one.

Fixes #3561

@github-actions
Copy link

github-actions bot commented Jun 12, 2022

📊 Tachometer Benchmark Results

Summary

A summary of the benchmark results will show here once they finish.

Results

The full results of your benchmarks will show here once they finish.

tachometer-reporter-action v2 for Benchmarks

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
…listener
@marconi1992 marconi1992 marked this pull request as ready for review June 12, 2022 09:07
@marconi1992 marconi1992 changed the title ensure both onchange and oninput callbacks are attached to the event listener Ensure both onchange and oninput callbacks are executes when typing Jun 12, 2022
@coveralls
Copy link

coveralls commented Jun 13, 2022

Coverage Status

Coverage remained the same at 99.444% when pulling acfb16d on marconi1992:onchange-compat into 0b9a927 on preactjs:master.

@JoviDeCroock
Copy link
Member

JoviDeCroock commented Jun 13, 2022

It looks like a lot of tests have stopped running 😅 trying to figure out how that is possible. the issue with size is fixed here #3563

@marconi1992 marconi1992 force-pushed the onchange-compat branch 2 times, most recently from 7e896b0 to bed76e8 Compare June 14, 2022 00:50
Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the back and forth and congratulations on your first PR ❤️

@JoviDeCroock JoviDeCroock merged commit c746ecf into preactjs:master Jun 14, 2022
@JoviDeCroock JoviDeCroock mentioned this pull request Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onInput and onChange doesn't work together since v10.5.0
4 participants