Skip to content

Commit e6538c9

Browse files
feat: keyboard key that triggers opening the popup (#2356)
1 parent 0e63e87 commit e6538c9

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Radzen.Blazor/RadzenDropDown.razor.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,22 @@ internal DropDownItemRenderEventArgs<TValue> ItemAttributes(RadzenDropDownItem<T
132132
return args;
133133
}
134134

135+
/// <summary>
136+
/// Gets or sets the keyboard key that triggers opening the popup when <see cref="OpenOnFocus"/> is enabled.
137+
/// Default is <c>"Enter"</c>.
138+
/// </summary>
139+
/// <value>The keyboard key used to open the popup.</value>
140+
[Parameter]
141+
public string OpenPopupKey { get; set; } = "Enter";
142+
135143
private async Task OnFocus()
136144
{
137145
if (OpenOnFocus)
138146
{
139-
await OpenPopup("Enter", false);
147+
await OpenPopup(OpenPopupKey, false);
140148
}
141149
}
150+
142151
internal override async Task ClosePopup(string key)
143152
{
144153
bool of = false;

Radzen.Blazor/RadzenDropDownDataGrid.razor.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,19 @@ protected virtual void OnRowRender(RowRenderEventArgs<object> args)
128128
[Parameter]
129129
public bool OpenOnFocus { get; set; }
130130

131+
/// <summary>
132+
/// Gets or sets the keyboard key that triggers opening the popup when <see cref="OpenOnFocus"/> is enabled.
133+
/// Default is <c>"Enter"</c>.
134+
/// </summary>
135+
/// <value>The keyboard key used to open the popup.</value>
136+
[Parameter]
137+
public string OpenPopupKey { get; set; } = "Enter";
138+
131139
private async Task OnFocus()
132140
{
133141
if (OpenOnFocus)
134142
{
135-
await OpenPopup("Enter", false);
143+
await OpenPopup(OpenPopupKey, false);
136144
}
137145
}
138146

0 commit comments

Comments
 (0)