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

Allow passing onBlur, onKeyUp, onKeyDown while still running emitChange #225

Open
tony opened this issue Apr 26, 2021 · 1 comment
Open

Comments

@tony
Copy link

tony commented Apr 26, 2021

onInput: this.emitChange,
onBlur: this.props.onBlur || this.emitChange,
onKeyUp: this.props.onKeyUp || this.emitChange,
onKeyDown: this.props.onKeyDown || this.emitChange,
contentEditable: !this.props.disabled,

emitChange triggers onChange, which sends up a typed event with event.target.value attached

In my case, onBlur, onKeyUp, onKeyDown aren't used to change state, but to toggle CSS classes.

@tony
Copy link
Author

tony commented Apr 26, 2021

Proposal would be, if a function is passed to this.props.on{Blur,KeyUp,KeyDown}, pass (event: React.SyntheticEvent<any>, emitChange(originalEvt: React.SyntheticEvent<any>) => void) to the prop, this way, they could still run emitChange(event) if they want.

I don't think this would be possible due to the underlying typings of on{Blur,KeyUp,KeyDown}

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

No branches or pull requests

1 participant