ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.12k stars 14.64k forks source link

[Bug Report] tooltip content too long and position cause tooltip beyond screen width #17661

Open SunGuoQiang123 opened 5 years ago

SunGuoQiang123 commented 5 years ago

Element UI version

2.11.1

OS/Browsers version

macOS 10.13.6 / chrome 79.0.3928.4

Vue version

2.6.10

Reproduction Link

https://jsfiddle.net/1a6t47Lb/7/

Steps to reproduce

move mouse over the 'show tooltip' which has the style 'text-align:right' div the tooltip show but its position style is 'left: -12px' cause the tooltip content oversize the screen width. the same issue happened when the table column add show-overflow-tooltip property

What is Expected?

the tooltip should show all content and not oversize the screen width

What is actually happening?

the tooltip content oversize the screen width and its style "left: -12px"

ekil1100 commented 5 years ago

I take a look the source code, I find out the tooltip component actually using the popper.js to handle the placement, offset, and arrowOffset. Maybe it is a bug of popper.js.

SunGuoQiang123 commented 5 years ago

@lastingman ok

lzq4047 commented 4 years ago

@SunGuoQiang123 Set position as relative can resolve this

body {
  position: relative;
}
lzq4047 commented 4 years ago

@SunGuoQiang123 Set position as relative can resolve this

body {
  position: relative;
}

or

.el-tooltip__popper {
  word-break: break-all;
}
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

avajayam commented 2 years ago

Set tooltip max-width not more than viewport width, e.g., .el-tooltip__popper { max-width: 90vw; }