Blazor Dropdown onchange only triggering via keyboard, not mouse

85 Views Asked by At

i have a really weird problem. I am using blazor .net 8, and have a simple dropdown and an onchange event.

    <select @onchange="SelectedChanged">
        <option value="1">1</option>
        <option value="2">2</option>
    </select>

@code {

public void SelectedChanged(ChangeEventArgs e)
{
}

}

The SelectedChanged event ONLY triggers if i change the dropdown using the keyboard keys (focus on it, then up/down arrows).

If i use a mouse to click on it, and click one of the options, it doesn't trigger.

Ultimately, this should work, right? If i change the dropdown into a 'multiple' one:

   <select @onchange="SelectedChanged" multiple>

then, via the mouse, the onchange works no problem. Other controls like buttons etc also trigger onchange when clicked with a mouse.

0

There are 0 best solutions below