Skip to content

Fixed string-items-list autocomplete selection and blur handling#15273

Merged
vvlladd28 merged 2 commits intothingsboard:lts-4.2from
vvlladd28:fix/string-items-list-autocomplete
Mar 24, 2026
Merged

Fixed string-items-list autocomplete selection and blur handling#15273
vvlladd28 merged 2 commits intothingsboard:lts-4.2from
vvlladd28:fix/string-items-list-autocomplete

Conversation

@vvlladd28
Copy link
Copy Markdown
Member

Summary

  • Replace manual addOnBlur handler with [matChipInputAddOnBlur]="true" directive and dedicated onOptionSelected handler for proper autocomplete selection
  • Add (mousedown)="$event.preventDefault()" on mat-options to prevent premature blur closing the panel before selection
  • Conditionally hide "not found" option when allowUserValue is enabled
  • Extend matAutocompleteDisabled check to also consider fetchOptionsFn
  • Simplify ngOnInit value change handling and improve clear() method reset logic

Test plan

  • Verify autocomplete dropdown stays open when clicking options
  • Verify chip input add-on-blur works correctly with the directive
  • Verify custom user values can be entered when allowUserValue is true
  • Verify "not found" message is hidden when allowUserValue is enabled
  • Verify fetchOptionsFn properly enables autocomplete

Replace addOnBlur with matChipInputAddOnBlur directive and dedicated onOptionSelected handler for proper autocomplete behavior. Prevent mousedown default on options to avoid premature blur, and conditionally hide "not found" when user values are allowed.
@vvlladd28 vvlladd28 changed the title UI: Fix string-items-list autocomplete selection and blur handling Fixed string-items-list autocomplete selection and blur handling Mar 19, 2026
@vvlladd28 vvlladd28 added Bug UI UI changes LTS Applied to Long-Term Support releases labels Mar 19, 2026
@vvlladd28 vvlladd28 added this to the 4.2.2.1 milestone Mar 19, 2026
Truthiness check on event.option.value would incorrectly route to
clear() for valid falsy values like 0 or "". Use != null instead.
@vvlladd28 vvlladd28 merged commit 411b600 into thingsboard:lts-4.2 Mar 24, 2026
5 checks passed
@vvlladd28 vvlladd28 deleted the fix/string-items-list-autocomplete branch March 24, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug LTS Applied to Long-Term Support releases UI UI changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant