Skip to content

Commit 628ef85

Browse files
Fixes Disabled not working. Fixes #9.
1 parent c63c912 commit 628ef85

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/SimpleBlazorMultiselect/SimpleMultiselect.razor

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
<button class="simple-dropdown-button btn dropdown-toggle" type="button"
1010
id="@Id"
1111
@onclick="ToggleDropdown"
12-
aria-expanded="@IsDropdownOpen">
12+
aria-expanded="@IsDropdownOpen"
13+
disabled="@Disabled">
1314
<span class="simple-dropdown-text">
1415
@if (SelectedOptions.Count == 0)
1516
{
@@ -69,8 +70,15 @@
6970
_dotNetHelper = DotNetObjectReference.Create(this);
7071
}
7172

73+
protected override async Task OnParametersSetAsync()
74+
{
75+
if (Disabled && IsDropdownOpen)
76+
await CloseDropdown();
77+
}
78+
7279
private async Task ToggleDropdown()
7380
{
81+
if (Disabled) return;
7482
IsDropdownOpen = !IsDropdownOpen;
7583
if (IsDropdownOpen)
7684
{

0 commit comments

Comments
 (0)