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

[Bug]: Tooltip content gets cutoff near the edge of the container #16928

Closed
2 tasks done
fbarroso24 opened this issue Jul 9, 2024 · 2 comments
Closed
2 tasks done

[Bug]: Tooltip content gets cutoff near the edge of the container #16928

fbarroso24 opened this issue Jul 9, 2024 · 2 comments

Comments

@fbarroso24
Copy link

Package

@carbon/react

Browser

Chrome

Package version

v1.53.1

React version

v18.2.0

Description

We have a flyover with a set max-width. The flyover contains various fields & tooltips. In some scenarios, the contents of the tooltip gets cutoff. This tends to happen if the tooltips appear near the edge of the container or if the contents of the tooltip contain a few sentences. Here's a screenshot below.
image

We have experimented with the autoAlign prop but that doesn't always work because sometimes the content of the tooltip will cutoff on the other side of the flyover. In addition, we have also investigated using isolation: 'isolate' & transform: translate3d(0, 0, 1px); to no avail.

We have been able to reproduce this on Stackblitz. The simple example is to put a tooltip near the edge with align='bottom' and then notice how the tooltip will get cutoff (see below).
image

One possible solution we have been looking at is to see if we could force the max-width of the tooltip to be smaller than the width of the container (e.g. flyover). However, that requires us to have an assortment of css style workarounds to try and cover all the permutations across all areas in the product.

It would be good if this were handled by the component OOTB.

Reproduction/example

https://stackblitz.com/edit/github-z8vcs7-cyux4s?file=src%2FApp.jsx

Steps to reproduce

The simple example is to put a tooltip near the edge with align='bottom' and then notice how the tooltip will get cutoff (see below).
image

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

OpenPages

Code of Conduct

@fbarroso24
Copy link
Author

FYI @tay1orjones @andy-blum

@riddhybansal
Copy link
Contributor

Hey there @fbarroso24 we have encountered such issues in many components and introduced a prop called "autoAlign". This will align the floating element where it best fits.
Here is the stackblitz example for the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants