[2.x] fix(tooltip): add container prop and fix notification button tooltip …#4375
Merged
Conversation
…positioning The Bootstrap tooltip `container` option was not exposed by the Tooltip component, so tooltips on elements inside overflow-clipped containers (like the notification dropdown) were positioned incorrectly. At certain screen resolutions this caused the tooltip to appear over the cursor, triggering a mousein/mouseout flicker loop that made the button hard to click. Add a `container` prop to `TooltipAttrs` and pass it through to the Bootstrap tooltip initialisation. Update `NotificationList` to use `container="body"`, which appends the tooltip to the document body so Bootstrap can position it correctly relative to the viewport regardless of any ancestor overflow constraints. Also removes the now-redundant `data-container` attributes from the Button elements, which were never read by the tooltip system. Fixes: #4353 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
imorland
added a commit
that referenced
this pull request
Feb 21, 2026
When `container` is set to `"body"` (or any element other than the
trigger's natural parent), Bootstrap appends the tooltip DOM node
directly to that container element rather than adjacent to the trigger.
When Mithril subsequently removes the trigger element from the DOM
(e.g. closing the notification dropdown), Bootstrap is never informed
and the tooltip DOM node is left stranded in the container — visible
forever, impossible to dismiss.
Without `container`, Bootstrap places the tooltip adjacent to the
trigger element; it is removed as part of normal DOM cleanup and the
issue does not manifest.
The fix adds an `onremove` lifecycle hook that calls `tooltip('destroy')`
on the child DOM node before Mithril removes it. This is identical to
the destroy call already used in `recreateTooltip()` when the tooltip
text changes, so the approach is consistent with the existing pattern.
Fixes the regression introduced by #4375 (adding `container="body"` to
the notification list tooltips to fix positioning inside the
overflow-clipped dropdown).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
imorland
added a commit
that referenced
this pull request
Feb 21, 2026
* fix(tooltip): destroy tooltip instance on component removal
When `container` is set to `"body"` (or any element other than the
trigger's natural parent), Bootstrap appends the tooltip DOM node
directly to that container element rather than adjacent to the trigger.
When Mithril subsequently removes the trigger element from the DOM
(e.g. closing the notification dropdown), Bootstrap is never informed
and the tooltip DOM node is left stranded in the container — visible
forever, impossible to dismiss.
Without `container`, Bootstrap places the tooltip adjacent to the
trigger element; it is removed as part of normal DOM cleanup and the
issue does not manifest.
The fix adds an `onremove` lifecycle hook that calls `tooltip('destroy')`
on the child DOM node before Mithril removes it. This is identical to
the destroy call already used in `recreateTooltip()` when the tooltip
text changes, so the approach is consistent with the existing pattern.
Fixes the regression introduced by #4375 (adding `container="body"` to
the notification list tooltips to fix positioning inside the
overflow-clipped dropdown).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
* chore: add tooltip onremove fix to beta.7 changelog
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---------
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
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.
…positioning
The Bootstrap tooltip
containeroption was not exposed by the Tooltip component, so tooltips on elements inside overflow-clipped containers (like the notification dropdown) were positioned incorrectly. At certain screen resolutions this caused the tooltip to appear over the cursor, triggering a mousein/mouseout flicker loop that made the button hard to click.Add a
containerprop toTooltipAttrsand pass it through to the Bootstrap tooltip initialisation. UpdateNotificationListto usecontainer="body", which appends the tooltip to the document body so Bootstrap can position it correctly relative to the viewport regardless of any ancestor overflow constraints. Also removes the now-redundantdata-containerattributes from the Button elements, which were never read by the tooltip system.Fixes: #4353
**Fixes #4353 **
Changes proposed in this pull request:
Reviewers should focus on:
Screenshot
Necessity
Confirmed
composer test).Required changes: