Material-ui: [Tooltip] Arrow placement issue

Created on 16 Apr 2020  路  11Comments  路  Source: mui-org/material-ui

  • [x] The issue is present in the latest release.
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

waov
When i add any special character in message, a line which is side of arrow shows up (Tooltip placement is left)

Expected Behavior 馃

Should no line or etc.

Your Environment 馃寧

| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.9.7 |
| React | v16.13.0 |
| Browser |Firefox 76.0b4 |

bug 馃悰 Tooltip good first issue

Most helpful comment

image

I checked the 1em solution in multiple browsers it seems to be fixing it. There is some very slight non-pleasant effect during the intro transition when browser lags to calculate correct position of the arrow but AFAIK such problems can only be solved with SVG-based whole-element solution

All 11 comments

Please provide a full reproduction test case. This would help a lot 馃懛 .
A live example would be perfect. This codesandbox.io template _may_ be a good starting point. Thank you!

@oliviertassinari
You can reach the test case in here;
https://codesandbox.io/s/kind-water-qi96n?file=/src/App.tsx

If you hover Bug and NoBug texts you can see the problem

@buraksakalli Thanks for the reproduction, what do you think of this patch?

diff --git a/packages/material-ui/src/Tooltip/Tooltip.js b/packages/material-ui/src/Tooltip/Tooltip.js
index 6c77af1b6..1083a2e08 100644
--- a/packages/material-ui/src/Tooltip/Tooltip.js
+++ b/packages/material-ui/src/Tooltip/Tooltip.js
@@ -25,7 +25,7 @@ function arrowGenerator() {
       flip: false,
       top: 0,
       left: 0,
-      marginTop: '-0.95em',
+      marginTop: '-1em',
       marginLeft: 4,
       marginRight: 4,
       width: '2em',
@@ -40,7 +40,7 @@ function arrowGenerator() {
       flip: false,
       bottom: 0,
       left: 0,
-      marginBottom: '-0.95em',
+      marginBottom: '-1em',
       marginLeft: 4,
       marginRight: 4,
       width: '2em',
@@ -54,7 +54,7 @@ function arrowGenerator() {
     '&[x-placement*="right"] $arrow': {
       flip: false,
       left: 0,
-      marginLeft: '-0.95em',
+      marginLeft: '-1em',
       marginTop: 4,
       marginBottom: 4,
       height: '2em',
@@ -68,7 +68,7 @@ function arrowGenerator() {
     '&[x-placement*="left"] $arrow': {
       flip: false,
       right: 0,
-      marginRight: '-0.95em',
+      marginRight: '-1em',
       marginTop: 4,
       marginBottom: 4,
       height: '2em',

Do you want to submit a pull request? :)

@oliviertassinari I've tried it yet but not solved

image

FYI on my 4k display it is visible on both examples

@esseswann Does the proposed patch solve it?

image

FYI on my 4k display it is visible on both examples

@esseswann, @oliviertassinari
You're right, but the patch didn't solve it.

@buraksakalli How did you try the patch?

@buraksakalli How did you try the patch?

I've applied your advices to Tooltip.js

@buraksakalli If you are referring to the Tooltip.js that is present in your node_modules, there are two. Does it display something if you add a console.log('edit');?

image

I checked the 1em solution in multiple browsers it seems to be fixing it. There is some very slight non-pleasant effect during the intro transition when browser lags to calculate correct position of the arrow but AFAIK such problems can only be solved with SVG-based whole-element solution

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TimoRuetten picture TimoRuetten  路  3Comments

ghost picture ghost  路  3Comments

ryanflorence picture ryanflorence  路  3Comments

pola88 picture pola88  路  3Comments

mb-copart picture mb-copart  路  3Comments