Skip to content

fix: Resolve invisible tooltip and negative constraints on widescreens#146

Merged
bensonarafat merged 4 commits intobensonarafat:develop2from
akhil-ge0rge:fix/widescreen-tooltip-layout
Nov 27, 2025
Merged

fix: Resolve invisible tooltip and negative constraints on widescreens#146
bensonarafat merged 4 commits intobensonarafat:develop2from
akhil-ge0rge:fix/widescreen-tooltip-layout

Conversation

@akhil-ge0rge
Copy link
Contributor

Description

This pull request fixes a critical layout bug where the tooltip would fail to render (appearing as a black overlay or invisible) when used on Web, Desktop, or wide-screen devices.

The issue stemmed from TooltipPositionDelegate using the tooltip's desired constraints (e.g., maxWidth: 400) instead of the screen's constraints to calculate available space. On wide screens, where target coordinates can be large, subtracting the target position from the relatively small desired width resulted in negative values, causing the layout to break.

Key Changes

TooltipPositionDelegate Logic Update:

  1. Updated getConstraintsForChild to use the parent (screen) constraints as the base for calculating available space.
  2. Added logic to intersect the "available space" with the "user-defined constraints" only after the available space is calculated.

SuperUtils Robustness:

  1. Refactored constraint calculations to explicitly clamp values to zero (math.max(0, ...)), ensuring robustness regardless of screen size.
  2. Removed logic that forced minWidth to equal maxWidth in specific scenarios, allowing the tooltip to shrink naturally if the content is smaller than the available margin.
  3. Fixed the math error where the target position was subtracted from the user's max width instead of the screen's width.

Testing

  • Run the example app on Web (resize the window to be wide).
  • Trigger the tooltip on a target positioned far from the screen origin.
  • Before: The tooltip would likely not appear, or only the barrier would show due to negative constraint calculations.
  • After: The tooltip renders correctly, constrained within the screen edges.

Issue

issue

Fix

fix

@bensonarafat bensonarafat changed the base branch from master to develop2 November 27, 2025 10:14
@bensonarafat bensonarafat merged commit 33068b5 into bensonarafat:develop2 Nov 27, 2025
2 checks passed
@akhil-ge0rge akhil-ge0rge deleted the fix/widescreen-tooltip-layout branch November 27, 2025 10:20
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.

2 participants