Skip to content

fix(combo): Invalid data state on tab out in single selection#2224

Open
rkaraivanov wants to merge 2 commits into
masterfrom
rkaraivanov/fix-2221
Open

fix(combo): Invalid data state on tab out in single selection#2224
rkaraivanov wants to merge 2 commits into
masterfrom
rkaraivanov/fix-2221

Conversation

@rkaraivanov
Copy link
Copy Markdown
Member

@rkaraivanov rkaraivanov commented May 12, 2026

Description

When tabbing out of a single select combo, commit the value if there is at least one match.

  • Do not call clearSelection() on Tab when active === -1 in single-select
    mode; an existing selection is preserved when no navigation occurred
  • Sync the native input value after _syncValueFromSelection so the main
    input reflects the current selection in single-select mode
  • Clear the native input value on blur when there is no selection,
    discarding any partial search text the user typed
  • Add tests covering the three affected scenarios

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to change)
  • Documentation update
  • Refactoring (code improvements without functional changes)

Related Issues

Closes #2221

Testing

Added unit test covering the scenario.

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • I have updated documentation if needed
  • Breaking changes are documented in the description

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an invalid state in the igc-combo single-select mode by committing the currently active match (or clearing selection) when the user tabs out of the component, aligning the displayed text with the component value and resolving #2221.

Changes:

  • Update Combo navigation Tab handling to select the active item (or clear) before closing in single-select mode.
  • Add a unit test covering tab-out behavior with a single match and with no matches.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/components/combo/controllers/navigation.ts Adjusts Tab key handling to commit/clear selection before hiding the dropdown in single-select mode.
src/components/combo/combo.spec.ts Adds regression test for single-select tab-out with matches vs. no matches.

Comment thread src/components/combo/controllers/navigation.ts Outdated
Comment thread src/components/combo/combo.spec.ts
- Do not call clearSelection() on Tab when active === -1 in single-select
  mode; an existing selection is preserved when no navigation occurred
- Sync the native input value after _syncValueFromSelection so the main
  input reflects the current selection in single-select mode
- Clear the native input value on blur when there is no selection,
  discarding any partial search text the user typed
- Add tests covering the three affected scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Single select Combo invalid state after leaving component without confirm action (Enter)

2 participants