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

fix: FluentAutocomplete should throw on use of SelectedOption #3400

Open
davhdavh opened this issue Feb 19, 2025 · 1 comment
Open

fix: FluentAutocomplete should throw on use of SelectedOption #3400

davhdavh opened this issue Feb 19, 2025 · 1 comment
Assignees
Labels
status:needs-investigation Needs additional investigation

Comments

@davhdavh
Copy link

🐛 Bug Report

FluentAutocomplete throws if setting Multiple to false, but if set/bind the SelectedOption it just doesn't work.

💻 Repro or Code Sample

NA

🤔 Expected Behavior

Throw like Multiple

😯 Current Behavior

Silently does not work

💁 Possible Solution

Alternative to throw would be to set MaximumSelectedOptions to null/1 and fix the code to use it SelectedOption when MaximumSelectedOptions is null/1 to make it consistent with other list components.

@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New issue. Needs to be looked at label Feb 19, 2025
@vnbaaij vnbaaij added status:needs-investigation Needs additional investigation and removed triage New issue. Needs to be looked at labels Feb 19, 2025
@MarvinKlein1508
Copy link
Contributor

MarvinKlein1508 commented Mar 5, 2025

I find this behavior quite strange as well. However, I think it might be intentional for some reason, as the exception is explicitly thrown:

throw new ArgumentException("For FluentAutocomplete, this property must be True. Set the MaximumSelectedOptions property to 1 to select just one item.");

In my opinion, FluentCombobox should be used for single items, while FluentAutocomplete should be used for multiple items. However, I am currently using FluentAutocomplete for single objects as well because FluentCombobox does not support a dynamic item provider.

I've created a small example demonstrating how you can achieve single binding with FluentAutocomplete, which is quite tricky to do. You can find it here:
#2443

Maybe this is something which you can take a look on for v5? I would highly appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs-investigation Needs additional investigation
Projects
None yet
Development

No branches or pull requests

4 participants