Skip to content

Feature: add truncation detection to the Tooltip component - #336

Draft
b1ink0 wants to merge 1 commit into
feat/timesheetfrom
fix/issue-2052
Draft

Feature: add truncation detection to the Tooltip component#336
b1ink0 wants to merge 1 commit into
feat/timesheetfrom
fix/issue-2052

Conversation

@b1ink0

@b1ink0 b1ink0 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Description

This pull request introduces a new feature to the Tooltip component, allowing tooltips to be shown only when the associated text is visually truncated.

Relevant Technical Choices

  • Added a new showWhen prop ("always" or "truncated") and an optional truncationRef prop to TooltipProps, allowing tooltips to appear only when the referenced element's text is truncated.

Testing Instructions

Screenshot/Screencast


Checklist

  • If this PR adds a new component, it has a linked issue that was discussed and approved before I started work.
  • I have thoroughly tested this code to the best of my abilities.
  • I have reviewed the code myself before requesting a review.
  • This code is covered by unit tests to verify that it works as intended.
  • The QA of this PR is done by a member of the QA team (to be checked by QA).

Partially fixes rtCamp/next-pms#2052

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional truncation-aware display behavior to Tooltip, supporting the linked next-pms enhancement.

Changes:

  • Adds showWhen and truncationRef props.
  • Detects horizontal text truncation before opening.
  • Adds Storybook controls and interaction coverage.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
utils.ts Adds truncation detection utility.
types.ts Defines the new public props and mode type.
tooltip.tsx Conditionally cancels tooltip opening.
tooltip.stories.tsx Documents the new props in Storybook.
tooltip.interactions.stories.tsx Tests truncated and non-truncated cases.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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