MudBlazor/MudBlazor

MudDialog: The close event caused text boxes within the dialog box that had not yet lost focus not to submit changes.

Closed

#13,172 opened on May 6, 2026

 (2 comments) (0 reactions) (0 assignees)C# (1,631 forks)batch import
bughas workaroundhelp wantedregression

Repository metrics

Stars
 (10,394 stars)
PR merge metrics
 (Avg merge 6d 6h) (108 merged PRs in 30d)

Description

Before reporting

  • I searched existing issues
  • I tried in private/incognito browser

What went wrong?

Bug type

Component

Component name

MudDialog

What happened?

I have a very simple dialog box containing only a MudTextField. In version 8.x.x, the logic is that after filling in the information and clicking the close button of the dialog box, the value of the MudTextField is submitted. However, in version 9.x.x, the logic is that after filling in the information and clicking the close button of the dialog box, the value of the MudTextField is not submitted. The MudTextField must first lose focus before clicking the close button for the value to be submitted.

Temporary solution

Google Gemini provides a temporary solution to this problem, add the following code to index.html.

<script>
    document.addEventListener('mousedown', function(e) {
        if (e.target.closest('button')) { 
            var activeEle = document.activeElement;
            if (activeEle && (activeEle.tagName === 'INPUT' || activeEle.tagName === 'TEXTAREA')) {
                activeEle.blur(); 
            }
        }
    }, true);
</script>

Reproduction link

https://try.mudblazor.com/snippet/GuGAEfOqwpshyitU

Reproduction steps

  1. click button
  2. input something
  3. keep text filed focus
  4. close dialog
  5. click button again
  6. expect:show before input
  7. step3: if make text filed lost focus,then close dialog, work fine.

Version (bug)

v9.4.0

Version (working)

v8.15.0

Environment

Edge, Chrome

Blazor rendering mode

WASM

Contributor guide