Skip to content

Dispatch the combobox input event so onInput works - #663

Open
arpitjain099 wants to merge 1 commit into
GSA:masterfrom
arpitjain099:fix/combobox-dispatch-input-event
Open

Dispatch the combobox input event so onInput works#663
arpitjain099 wants to merge 1 commit into
GSA:masterfrom
arpitjain099:fix/combobox-dispatch-input-event

Conversation

@arpitjain099

Copy link
Copy Markdown

Fixes #659.

_initEventDispatcher registers "input" and onInput() subscribes to it, but _setupInputEvents only dispatched "search", so a callback passed to onInput() was never called. Nothing surfaced it either: EventDispatcher.on accepts 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.ts uses onSearch), 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.ts is new; the class had no spec before. Three cases: the onInput callback fires, the onSearch callback still fires, and both receive the same input event in order.

Against master:

× should call an onInput callback when the input changes
  → expected +0 to be 1
× should pass the input event through to both callbacks
  → expected [ 'search:input' ] to deeply equal [ 'input:input', 'search:input' ]
Tests  2 failed | 1 passed (3)

With the change, 3 passed. The onSearch case passes either way on purpose, since the point of the change is that it must keep working.

prettier --check is 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-icons and 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.

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>
@arpitjain099
arpitjain099 requested a review from a team as a code owner August 29, 2026 18:59
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

Successfully merging this pull request may close these issues.

AbstractCombobox.onInput() is a public no-op — input event never dispatched

1 participant