Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: sbbAutocompleteTrigger writeValue is asynchronous #2407

Open
3 tasks done
daniel-sc opened this issue Oct 28, 2024 · 2 comments
Open
3 tasks done

[Bug]: sbbAutocompleteTrigger writeValue is asynchronous #2407

daniel-sc opened this issue Oct 28, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@daniel-sc
Copy link
Contributor

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

@daniel-sc daniel-sc added the bug Something isn't working label Oct 28, 2024
@kyubisation
Copy link
Collaborator

Our autocomplete implementation is adapted from the Material implementation (angular/components), which uses this approach as well. My assumption is that this is a limitation with the potentially changing sbb-option instances.
I'm not sure we can fix that.

@mhaertwig
Copy link
Collaborator

angular/components#3250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants