Skip to content

Comments

feature(search): Include option descriptions in search when searchNormalize is true; fix add-new-option crash#464

Open
gnbm wants to merge 4 commits intosa-si-dev:masterfrom
gnbm:gm/search-descriptions
Open

feature(search): Include option descriptions in search when searchNormalize is true; fix add-new-option crash#464
gnbm wants to merge 4 commits intosa-si-dev:masterfrom
gnbm:gm/search-descriptions

Conversation

@gnbm
Copy link
Collaborator

@gnbm gnbm commented Feb 19, 2026

Feature: Option descriptions in search when searchNormalize is true

Before

With searchNormalize: true, only labels were normalized for search. Descriptions were matched with toLowerCase() only, so diacritics were not normalized.

Example: Searching brulee did not match an option with description Crème brûlée.

After

Descriptions are normalized the same way as labels when searchNormalize is true. Precomputed descriptionNormalized in setOptions() and getOptionObj(), and used in isOptionVisible().

Example: Searching brulee now matches Crème brûlée.

Changes

  • Precompute descriptionNormalized and valueNormalized when options are prepared
  • Use precomputed fields in isOptionVisible() for consistent diacritic-insensitive matching
  • Update docs and types to state that searchNormalize applies to both label and description

Bug fix: Crash when adding a new option in single-select

Before

Selecting the "add new option" item in single-select could throw:

TypeError: Cannot read properties of undefined (reading 'index')
at VirtualSelect.beforeSelectNewValue

The displayed value was sometimes wrong or missing.

After

If the temporary new option was removed before beforeSelectNewValue() runs (e.g. when dropdown closes and search is cleared), we re-add the option via setNewOption(selectedValue) and mark it selected. No crash, and the value displays correctly.

Changes

  • Add null check for getNewOption() in beforeSelectNewValue()
  • When temp option is missing but selectedValue exists, re-add the option and set it as selected

Test cases

Test Description
matches descriptions as-is when searchNormalize is false Search brû matches option with description Crème brûlée
does not normalize descriptions when searchNormalize is false Search brulee does not match when searchNormalize is false
normalizes descriptions when searchNormalize is true Search brulee matches Crème brûlée when searchNormalize is true
add a new option (Allow to add new option) Search Option not exist, select it, value text shows Option not exist without crash

Validations

Ran regression scenarios in the documentation using the branch - ✅
Run automated tests - ✅

image

gnbm added 4 commits February 19, 2026 09:09
…ix allowNewOption crash

- Precompute descriptionNormalized/valueNormalized for consistent diacritic matching
- Fix beforeSelectNewValue when temp new option removed during single-select close
Covers: description match when searchNormalize=false, no match for normalized
query when false, match for normalized query when true.
Clarify in properties.md and types that searchNormalize applies to both label
and description. Add "Description search normalize" example with diacritic data.
Clarify in properties.md and types that searchNormalize applies to both label
and description. Add "Description search normalize" example with diacritic data.
@gnbm gnbm added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Feb 19, 2026
@gnbm gnbm requested a review from sa-si-dev February 19, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant