fix: prevent custom event and tooltip errors - #5189
Merged
Denis Voituron (dvoituron) merged 3 commits intoAug 22, 2026
Merged
Denis Voituron (dvoituron) merged 3 commits into
Denis Voituron (dvoituron) merged 3 commits into
Conversation
James Newton-King (JamesNK)
requested review from
Denis Voituron (dvoituron) and
Vincent Baaij (vnbaaij)
as code owners
August 22, 2026 00:17
Copilot started reviewing on behalf of
James Newton-King (JamesNK)
August 22, 2026 00:18
View session
Member
Author
|
Javier Calvarro Nelson (@javiercn) This was found while running Fluent UI Blazor v5 with Native AOT on .NET 11 in microsoft/aspire#19565. |
Member
Author
|
Please manual test before merging. I've just made suggested changes by AI, I haven't done any manual testing. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Core.Scripts startup/runtime wiring to avoid .NET 11 Blazor custom-event registration failures and to prevent tooltip popover callbacks from throwing after the element is removed from the DOM.
Changes:
- Ensures Fluent custom events are registered only once globally (even if both Web and Server startup hooks run).
- Bridges Blazor’s
overflowchangecustom event to an internalfluentoverflowchangebrowser event while still dispatching the publicoverflowchangeDOM event. - Overrides
fluent-tooltip’sshowPopover()to no-op when the tooltip is disconnected, avoiding Chromium invalid-state exceptions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core.Scripts/src/FluentUIWebComponentsOverride.ts | Adds a fluent-tooltip showPopover override that ignores stale callbacks after disconnect. |
| src/Core.Scripts/src/FluentUICustomEvents.ts | Wraps registerCustomEventType with global defineOnce and remaps Overflow’s browser event name to fluentoverflowchange. |
| src/Core.Scripts/src/Components/Overflow/FluentOverflow.ts | Dispatches both overflowchange and fluentoverflowchange events with identical payloads. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Denis Voituron (dvoituron)
requested changes
Aug 22, 2026
Denis Voituron (dvoituron)
approved these changes
Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
📖 Description
Removes the need for the application-level startup workaround used with Fluent UI Blazor 5.0.0-rc.5:
overflowchangecustom event to a distinct internalfluentoverflowchangebrowser event, as required by .NET 11.overflowchangeDOM event for JavaScript consumers.showPopover()only forfluent-tooltipso a delayed tooltip callback is ignored after the element has been disconnected. This avoids Chromium's invalid-state exception without modifyingHTMLElement.prototypeglobally.The failures were found while running Fluent UI Blazor with Native AOT on .NET 11 in microsoft/aspire#19565.
🎫 Issues
Related to #4626.
👩💻 Reviewer Notes
Please focus on the dual overflow event dispatch and the global
defineOnceregistration key. The public Blazor event remainsoverflowchange, and the documented DOM event remains available;fluentoverflowchangeis an internal bridge event.The tooltip override intentionally delegates to the original
fluent-tooltipshowPopoverimplementation only while the tooltip remains connected.📑 Test Plan
npm run buildnode ./esbuild.config.mjs --build-mode=Releasegit diff --check✅ Checklist
General
Component-specific
⏭ Next Steps
No follow-up work is currently required.