Skip to content

[Bug]: sbbAutocompleteTrigger writeValue is asynchronous #2407

@daniel-sc

Description

@daniel-sc

Preflight Checklist

Bug type

Functionality

Which version are you using

18.5.0

Operating system

Win11

Browser / Browser version

Firefox 131.0.3 (64-bit)

Input mode

None

Additional settings

No response

What happened?

When invoking writeValue (explicitly or implicitly via FormControl.setValue) on an input which has a autocomplete attached, the value is not synchronously applied to the HTMLInputElement.value, but only on the next tick.

This breaks the (implicit) contract, that the value should be reflected synchronously in the native elements value.

Relevant code:

Promise.resolve(null).then(() => this._assignOptionValue(value));

See as well: angular/components#3250

Steps to reproduce the issue

  1. Invoke FormControl.setValue('a') on a FormControl bound to an input with autocomplete
  2. Observe: input.nativeElement.value is not 'a' (which would be expected)

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions