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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Value set from outside of component is not displayed in FluentCombobox. #308

Closed
filipigic opened this issue Feb 2, 2023 · 0 comments
Assignees
Labels
bug A bug

Comments

@filipigic
Copy link

filipigic commented Feb 2, 2023

馃悰 Bug Report

I'm having issues with displaying the option I have set from the code to a FluentCombobox after the component has been interacted with through the UI. Similar to the behaviour here in #266.

馃捇 Repro or Code Sample

<p>Selected value: @selectedValue</p>

<FluentButton Appearance="Appearance.Accent" @onclick="@(() => ChangeValue("A"))">A</FluentButton>
<FluentButton Appearance="Appearance.Accent" @onclick="@(() => ChangeValue("B"))">B</FluentButton>
<FluentButton Appearance="Appearance.Accent" @onclick="@(() => ChangeValue("C"))">C</FluentButton>

<FluentCombobox
    Items="@values"
    @bind-Value="@selectedValue"/>

@code {
    private List<string> values = new List<string> { "A", "B", "C" };
    private string selectedValue = "A";

    private void ChangeValue(string value)
    {
        selectedValue = value;
    }
}

Setting a selected value with the buttons works fine when first initialised. However, if you were to set a selected value from the combobox and then tried to set a selected value from the buttons it wouldn't work.

馃 Expected Behaviour

The buttons selected should still set the option in the combobox.

馃槸 Current Behaviour

The selected value is not reflected in the combobox.

image

馃拋 Possible Solution

Currently in the FluentCombox component the value is being set to the attribute "value".

value=@Value

The attribute should be changed to "current-value".

current-value=@Value

A temporary workaround is to set the "current-value" through the additional attributes field.

I don't mind contributing and making the change.

馃實 Your Environment

.NET 6.0
Microsoft.Fast.Components.FluentUI (2.0.3)
FluentUI Web Components (2.5.12)
Edge (109.0.1518.70)

@vnbaaij vnbaaij self-assigned this Feb 4, 2023
@vnbaaij vnbaaij added the bug A bug label Feb 4, 2023
@vnbaaij vnbaaij closed this as completed in f172fc5 Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug
Projects
None yet
Development

No branches or pull requests

2 participants