Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhance OverflowTooltip overflow detection for precise handling of non-integral width or height #806

Merged
merged 6 commits into from
Nov 15, 2023

Conversation

tinaClin
Copy link
Contributor

@tinaClin tinaClin commented Nov 13, 2023

Issue

The column width is set to 180px, and the text is 'V1ES-Workload Security'.
The length of the text (including cell padding of 12px on each side), it exactly matches the 180px width.
This results in scrollWidth === clientWidth (no OverflowTooltip displayed), but the style is truncated.

Screenshot 2023-11-15 at 4 29 13 PM

Env

MacOS Ventura 13.6
image

Chrome 119.0.6045.123
image

Solution

Using getBoundingClientRect / getClientRects to obtain width with fractional precision instead of scrollWidth
CodeSandbox: https://codesandbox.io/s/overflowtooltip-issue-7vjsls?file=/src/CustomOverflowTooltip/CustomOverflowTooltip.js

image image

@tinaClin tinaClin added the 🐛 bug Something isn't working label Nov 13, 2023
@tinaClin tinaClin requested a review from cheton November 13, 2023 05:01
@tinaClin tinaClin self-assigned this Nov 13, 2023
Copy link

codesandbox bot commented Nov 13, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

codesandbox-ci bot commented Nov 13, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a6ef610:

Sandbox Source
overflowtooltip issue PR

@trendmicro-frontend-bot
Copy link
Contributor

trendmicro-frontend-bot commented Nov 13, 2023

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (2a849da) 71.35% compared to head (a6ef610) 71.40%.

Files Patch % Lines
packages/react/src/tooltip/OverflowTooltip.js 83.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #806      +/-   ##
==========================================
+ Coverage   71.35%   71.40%   +0.05%     
==========================================
  Files         374      374              
  Lines        6256     6267      +11     
==========================================
+ Hits         4464     4475      +11     
  Misses       1792     1792              
Flag Coverage Δ
react 73.12% <83.33%> (+0.07%) ⬆️
react-hooks 87.59% <100.00%> (+<0.01%) ⬆️
react-lab 14.04% <ø> (ø)
styled-system 91.73% <ø> (ø)
theme 100.00% <ø> (ø)
utils 70.28% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cheton cheton force-pushed the fix-overflowtooltip-issue branch from 695b221 to 00a9bc6 Compare November 15, 2023 04:07
@cheton cheton changed the title fix: fix the OverflowTooltip issue in a specific environment refactor: address the OverflowTooltip issue in boundary test scenarios Nov 15, 2023
@cheton cheton force-pushed the fix-overflowtooltip-issue branch from 00a9bc6 to c8681c6 Compare November 15, 2023 06:10
@cheton cheton force-pushed the fix-overflowtooltip-issue branch from c8681c6 to 3c9ad7e Compare November 15, 2023 07:17
@cheton cheton added the 👷 refactor (improvement) Improvements in the code base label Nov 15, 2023
@cheton cheton linked an issue Nov 15, 2023 that may be closed by this pull request
@cheton cheton changed the title refactor: address the OverflowTooltip issue in boundary test scenarios feat: enhance overflow detection in OverflowTooltip component for precise handling of non-integral width or height Nov 15, 2023
@cheton cheton changed the title feat: enhance overflow detection in OverflowTooltip component for precise handling of non-integral width or height feat: enhance OverflowTooltip overflow detection for precise handling of non-integral width or height Nov 15, 2023
@cheton cheton merged commit a1db209 into master Nov 15, 2023
4 checks passed
@cheton cheton deleted the fix-overflowtooltip-issue branch November 15, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 👷 refactor (improvement) Improvements in the code base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The string is truncated, but the OverflowTooltip is not displayed
3 participants