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: Page not responding in combobox from a list of Option<T> items #3029

Open
danny-may opened this issue Dec 7, 2024 · 6 comments
Open
Labels
area:blazor A blazor-specific issue bug A bug

Comments

@danny-may
Copy link

🐛 Bug Report

If you enter a free text value into a combobox from a list of Option items the page will become unresponsive.

💻 Repro or Code Sample

On the demo site, change the text in the combobox to one that does not exist, and then click out of the combobox. The page will become unresponsive
https://www.fluentui-blazor.net/Combobox#fromalistofoptiontit
Image

🤔 Expected Behavior

The page should not become unresponsive. I guess that it should either accept the inputted value as plaintext or reset to the previous value?

😯 Current Behavior

The page becomes unresponsive and requires killing by the browser

💁 Possible Solution

My guess would be that it cannot find the option which matches the input and goes into some kind of infinite loop

🔦 Context

I was trying to find an autocomplete-like component which only allows a single selection and has an async search function. I was trying out the behaviour of a few other components to see if any other worked well for this.

🌍 Your Environment

  • OS & Device: Windows 11
  • Browser Firefox 133.0
  • .NET and Fluent UI Blazor library Version: No idea, whatever the demo site is using
@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New issue. Needs to be looked at label Dec 7, 2024
@dvoituron
Copy link
Collaborator

This only seems to happen with the WASM version of the components (not in Blazor Server).

@dvoituron
Copy link
Collaborator

I was trying to find an autocomplete-like component which only allows a single selection and has an async search function. I was trying out the behaviour of a few other components to see if any other worked well for this.

You can use the FluentAutocomplete component to do that, with the attribute MaximumSelectedOptions="1"

@dvoituron dvoituron added the needs: author feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Dec 8, 2024
@danny-may
Copy link
Author

danny-may commented Dec 8, 2024

I was trying to find an autocomplete-like component which only allows a single selection and has an async search function. I was trying out the behaviour of a few other components to see if any other worked well for this.

You can use the FluentAutocomplete component to do that, with the attribute MaximumSelectedOptions="1"

That was what I used initially, but you end up with your selection showing up as a tag and can still type after it, which I didnt think looked great for how I wanted to use it.
Image

Thats besides the point of this ticket though, I was just describing how I found the issue. I ended up making my own autocomplete for single selection scenarios which is pretty much the same as the existing one just without the tags

@dvoituron
Copy link
Collaborator

You can customize the FluentAutocomplete to display selected elements as “plain” text (rather than as a tag).
For example, using the following code

@* Template used with each Selected items *@
<SelectedOptionTemplate>
    <div style="white-space: nowrap;">
        @($"{context.FirstName} {context.LastName}")
    </div>
</SelectedOptionTemplate>

Image

@danny-may
Copy link
Author

Thats pretty neat, Ill give that a shot. Thanks!

@vnbaaij vnbaaij added bug A bug area:blazor A blazor-specific issue and removed needs: author feedback The author of this issue needs to respond in order for us to continue investigating this issue. triage New issue. Needs to be looked at labels Dec 12, 2024
@MarvinKlein1508
Copy link
Contributor

I can confirm as well that this is only broken in the WASM variant. I've tested it in Firefox. Once I click out of the control my entire tab is frozen and doesn't work anymore until I do a manual refresh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:blazor A blazor-specific issue bug A bug
Projects
None yet
Development

No branches or pull requests

4 participants