Dispatch the combobox input event so onInput works - #663
Open
arpitjain099 wants to merge 1 commit into
Open
Conversation
AbstractCombobox registers "input" as a valid event and exposes onInput() to subscribe to it, but the native input listener only ever dispatched "search". A caller using onInput() therefore registered a callback that was never invoked, with no error to indicate it: the dispatcher accepts the registration because the event name is valid. Dispatch "input" alongside "search" rather than removing onInput(). Nothing in the tree calls onInput() today, so either would compile, but dispatching keeps the declared API and cannot break a consumer outside this repository that is already subscribing. Adds the first spec for this class, covering both callbacks and the event they receive. Fixes GSA#659 Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #659.
_initEventDispatcherregisters"input"andonInput()subscribes to it, but_setupInputEventsonly dispatched"search", so a callback passed toonInput()was never called. Nothing surfaced it either:EventDispatcher.onaccepts the registration because the event name is a valid one, and only throws for names it does not know.Of the two options in the issue I took dispatching over removing. Nothing in this repository calls
onInput()today (picker.tsusesonSearch), so removal would compile cleanly here, but it would break any consumer outside the repo that is already subscribing and would turn a dormant bug into a build failure for them. Dispatching keeps the declared API and makes it do what its name says.Testing
abstract-combobox.spec.tsis new; the class had no spec before. Three cases: theonInputcallback fires, theonSearchcallback still fires, and both receive the same input event in order.Against
master:With the change, 3 passed. The
onSearchcase passes either way on purpose, since the point of the change is that it must keep working.prettier --checkis clean on the directory.One caveat on the full suite: running all of
test-app's vitest here fails to transform 33 spec files on missing peer packages (@fortawesome/free-solid-svg-iconsand similar), before and after this change alike, so I ran the combobox spec on its own rather than quote a suite number I could not attribute.