Dispatch the combobox input event so onInput works - #663
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>
There was a problem hiding this comment.
Pull request overview
Fixes the combobox’s dormant onInput() API while preserving existing search behavior.
Changes:
- Dispatches the native input event to both input and search subscribers.
- Adds focused regression and compatibility tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
abstract-combobox.ts |
Dispatches the registered "input" event. |
abstract-combobox.spec.ts |
Tests input callbacks, search callbacks, and dispatch order. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@arpitjain099 FYI as this repository is a work of the US government it contains large parts of the code that are public domain. Are you willing to assign your code as such to keep the licensing simple for other users? |
|
Thank you for this contribution, @arpitjain099 — genuinely appreciated. Your diagnosis here was exactly right: Closing as superseded: the same fix landed on The only reason this isn't a straight merge is branch age — this was cut from a much older None of that reflects on the work — the analysis stood up and the outcome on |
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.