Skip to content

MudDialog: Fix inline dialog ignoring OnKeyDown and OnKeyUp - #14211

Merged
danielchalmers merged 1 commit into
devfrom
muddialog-inline-key-callbacks
Nov 13, 2026
Merged

danielchalmers merged 1 commit into
devfrom
muddialog-inline-key-callbacks

Conversation

@danielchalmers

Copy link
Copy Markdown
Member

An inline MudDialog, declared in markup and shown through Visible or ShowAsync, never invoked its OnKeyDown or OnKeyUp.
ShowAsync copies the inline dialog's parameters onto the dialog it shows through the dialog service, and those two were missing from the copy, so the dialog container only saw empty callbacks.
A dialog shown by the service wasn't affected.

ShowAsync now passes both.

Tests: InlineDialog_KeyEvents_ShouldReachOnKeyDownAndOnKeyUp fails on dev. The full MudBlazor.UnitTests suite passes (6,569 passed, 0 failed), with no build warnings on net8.0, net9.0 and net10.0.

In the Test Viewer, headless Chrome sent real key events to three dialogs: one shown through @bind-Visible, one through ShowAsync(), and one shown by the service as the control. On dev only the service dialog logged Enter, a letter, ArrowDown and Tab; with this change all three log the same keys in the same order. Escape still closes each dialog, and typing into a field inside works as before.

Found while testing #14208.

@danielchalmers danielchalmers added the bug Unexpected behavior or functionality not working as intended label Nov 13, 2026

@mudbot mudbot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShowAsync now passes the inline dialog's OnKeyDown and OnKeyUp through to the dialog the service shows. That's where MudDialogContainer reads them, so the handlers now fire for inline dialogs. The new test covers both callbacks, and I found nothing that needs fixing.

@danielchalmers
danielchalmers merged commit 5514ff4 into dev Nov 13, 2026
14 checks passed
@danielchalmers
danielchalmers deleted the muddialog-inline-key-callbacks branch November 13, 2026 18:34
This was referenced Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant