Describe the bug; what happened?
change event is not emitted on an fast-text-field element when the value is cleared or the last character is deleted.
What are the steps to reproduce the issue?
call addEventListener('change', ()=>console.log('change')) on an element and observe console
What behavior did you expect?
'change' event is emitted when value is cleared
In what environment did you see the issue?
Is there any additional context?
This is important for integration with Aurelia e.g., where binding engine listens for events to update bindings
I noticed looking into this that the behavior of fast-text-field diverges from the platform regarding when change events are fired. https://codesandbox.io/s/loving-jackson-rpi4j?file=/src/index.ts
A text input will only emit a change event after the user has finished changing the control and has moved focus away from the input. The behavior should mimic the behavior described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event
What you're likely looking for is the input event but I don't believe that the fast-text-field emits that event at this point. I'd like to propose the following:
fast-text-field's change event to match the platform's <input type="text" />fast-text-field to emit an input event, again matching the platform's <input type="text />
Most helpful comment
I noticed looking into this that the behavior of
fast-text-fielddiverges from the platform regarding whenchangeevents are fired. https://codesandbox.io/s/loving-jackson-rpi4j?file=/src/index.tsA text input will only emit a change event after the user has finished changing the control and has moved focus away from the input. The behavior should mimic the behavior described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event
What you're likely looking for is the input event but I don't believe that the
fast-text-fieldemits that event at this point. I'd like to propose the following:fast-text-field's change event to match the platform's<input type="text" />fast-text-fieldto emit aninputevent, again matching the platform's<input type="text />