fix: text field onChange
event incorrectly firing when wrapped as React component
#5551
Labels
community:question
A question from the community.
status:controversial
An issue or PR revolved around a controversial discussion or change.
status:under-consideration
Issue is being reviewed by the team.
🐛 Bug Report
Passing along a report from @mattrothenberg who is using the VS Code toolkit React components in the GitHub Next Flat Editor extension. (Matt if I miss anything in this bug report feel free to chime in and add details).
The short version is that he's run into an issue where the
onChange
event handler is firing at incorrect times based on React event standards (which, to be clear, stray from nativechange
event standards).In React land, this event should fire for every keystroke in the text field. However, this event is only firing when blurring away from the focused input (which, again, correctly follows the native
change
event standard).The hope is that there might be some way to adjust the behavior of
onChange
when defining/using the React-based toolkit components while keeping the regular/defaultchange
event behavior in the toolkit web components?💻 Repro or Code Sample
🤔 Expected Behavior
When wrapped in the
fast-react-wrapper
, fast foundation components should adjust the behavior of theonChange
/change
event to follow the conventions of React.😯 Current Behavior
When wrapped in the
fast-react-wrapper
, fast foundation components follow the behavior of the nativechange
event.💁 Possible Solution
Matt discovered there's a solution of using the
onInput
event to achieve the desired result of "fire event on every keystroke." If needed we're happy to just document this reality and tell people to useonInput
instead ofonChange
.🔦 Context
🌍 Your Environment
n/a (if needed Matt can provide info)
The text was updated successfully, but these errors were encountered: