Skip to content

Commit e81ea15

Browse files
committed
DropDown select item with SPACE added
Closes #2011, #2054
1 parent 647f174 commit e81ea15

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Radzen.Blazor/DropDownBase.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ protected virtual async System.Threading.Tasks.Task HandleKeyPress(Microsoft.Asp
679679
//
680680
}
681681
}
682-
else if (key == "Enter" || key == "NumpadEnter")
682+
else if (key == "Enter" || key == "NumpadEnter" || key == "Space")
683683
{
684684
preventKeydown = true;
685685

@@ -699,11 +699,14 @@ protected virtual async System.Threading.Tasks.Task HandleKeyPress(Microsoft.Asp
699699

700700
if (!popupOpened)
701701
{
702-
await OpenPopup(key, isFilter);
702+
if(key != "Space")
703+
{
704+
await OpenPopup(key, isFilter);
705+
}
703706
}
704707
else
705708
{
706-
if (!Multiple)
709+
if (!Multiple && !isFilter)
707710
{
708711
await ClosePopup(key);
709712
}
@@ -717,6 +720,8 @@ protected virtual async System.Threading.Tasks.Task HandleKeyPress(Microsoft.Asp
717720
}
718721
else if (key == "Escape" || key == "Tab")
719722
{
723+
preventKeydown = false;
724+
720725
await ClosePopup(key);
721726
}
722727
else if (key == "Delete" && AllowClear)

Radzen.Blazor/RadzenDropDown.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@if (Visible)
1010
{
1111
<div @ref="@Element" @attributes="Attributes" class="@GetCssClass()" onmousedown="Radzen.activeElement = null" @onclick="@(args => OpenPopup("ArrowDown", false, true))" @onclick:preventDefault @onclick:stopPropagation style="@Style" tabindex="@(Disabled ? "-1" : $"{TabIndex}")"
12-
@onkeydown="@((args) => OnKeyPress(args))" id="@GetId()" @onfocus="@((args) => OnFocus(args))">
12+
@onkeydown="@((args) => OnKeyPress(args))" @onkeydown:preventDefault="@preventKeydown" id="@GetId()" @onfocus="@((args) => OnFocus(args))">
1313
<div class="rz-helper-hidden-accessible">
1414
<input disabled="@Disabled" aria-haspopup="listbox" readonly="" type="text" tabindex="-1"
1515
name="@Name" value="@(internalValue != null ? internalValue : "")" id="@Name"

0 commit comments

Comments
 (0)