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

move invisible tooltip to the top left corner to prevent layout shift #277

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

stklcode
Copy link
Contributor

@stklcode stklcode commented Nov 12, 2023

Describe the bug

The tooltip is placed at the bottom of the body which makes the page slightly longer, even though the user can't see the content. This might result in a layout shift when the tooltip is displayed for the first time and the scrollbar disappears.

To Reproduce

  1. Visit a site dashboard with the Statify widget enabled and some data present in the database.
  2. Keep an eye on the page layout and the scrollbar, if visible.
  3. Hover over any data point in the Statify chart (shows tooltip)
  4. See the layout and/or scrollbar shift.

statify-tooltip-shift

Expected behavior

Tooltip is displayed without additional layout shift.


Solution

Move the invisible tooltip element to the top-left corner fixes this issue. We use left/top CSS properties, because these two will be dynamically overwritten on mouse events anyway.

The tooltip is placed at the bottom of the body which makes the page
slightly longer, even though the user can't see the content. This might
result in a layout shift when the tooltip is displayed for the first
time and the scrollbar disappears.

Move the invisible tooltip element to the top-left corner fixes this
issue. We use left/top CSS properties, because these two will be
dynamically overwritten on mouse events anyway.
Copy link

sonarcloud bot commented Apr 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@stklcode stklcode merged commit e127700 into develop Apr 5, 2024
19 checks passed
@stklcode stklcode deleted the fix/tooltip-offset branch April 5, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants