chanan / BlazorStrap

Bootstrap 4 Components for Blazor Framework
https://blazorstrap.io
The Unlicense
916 stars 157 forks source link

Validation removes active class on NavItem if IsTabs="true" #544

Closed Chri-s closed 2 years ago

Chri-s commented 2 years ago

Take the following example code

<BSNav IsTabs="false">
    <BSNavItem>
        <TabLabel>First tab</TabLabel>
        <TabContent>
            <BSForm Model="testModel" IsRow="true">                    
                <BSInput InputType="InputType.Text" @bind-Value="testModel.Test" ValidateOnChange="true" ValidateOnInput="true" />
            </BSForm>
        </TabContent>
    </BSNavItem>
    <BSNavItem>
        <TabLabel>Second tab</TabLabel>
    </BSNavItem>
</BSNav>

@code {
    private TestModel testModel = new TestModel();

    private class TestModel
    {
        public string Test { get; set; } = string.Empty;
    }
}                     

If you start this code, the first tab is active. Click into the input text box, the tab is still active. Now enter any key into the textbox and wait a second. Now the first tab isnt't active any more, but the content of the tab is still shown.

If you disable the validation, the tab stays active when changing the text box.

jbomhold3 commented 2 years ago

Fixed issue was the code kept trying to reset the first tab to active this was even happening on a StateHasChanged() .