Skip to content

Make blur events on Blazor components non rendering - #3073

Merged
rajsite merged 5 commits into
mainfrom
non-rendering-blur-event
Sep 28, 2026
Merged

rajsite merged 5 commits into
mainfrom
non-rendering-blur-event

Conversation

@mollykreis

@mollykreis mollykreis commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

🤨 Rationale

The blur events on components in NimbleBlazor cause the component to re-render when they are fired. In most cases, this isn't a problem because the component re-rendering when it is blurred isn't noticeable. However, for some parent components (like the NimbleDialog), it causes problems because the whole subtree is re-rendered when the dialog is blurred. This means that if it is blurred by an action not represented in the component bindings, such as opening a select, that action is lost.

👩‍💻 Implementation

  • Add a new EventUtilities internal static class to NimbleBlazor that is heavily based on Microsoft docs (only changes are to satisfy the repo's lint rules)
  • Update all blur events in NimbleBlazor to use the new EventUtilities helpers to keep the blur event firing from causing a component render

🧪 Testing

Manually tested in the example app the known problematic scenario, which is multiple selects in a dialog. Without this change, opening a select takes 2 clicks because a blur event on the dialog causes the select to render immediately after it is opened (rendering in the closed state). With this change, that no longer occurs.

✅ Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@mollykreis
mollykreis marked this pull request as ready for review September 28, 2026 20:15
@rajsite
rajsite enabled auto-merge (squash) September 28, 2026 20:42
@rajsite
rajsite disabled auto-merge September 28, 2026 20:43
@rajsite
rajsite merged commit 6631d56 into main Sep 28, 2026
10 checks passed
@rajsite
rajsite deleted the non-rendering-blur-event branch September 28, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blazor: New blur event support causes additional renders (problematic in dialogs)

3 participants