File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export function setTooltipPosition(tooltipEl, referencedElement) {
77 tooltipEl . style . left = '' ;
88 tooltipEl . style . right = '' ;
99 tooltipEl . style . bottom = '' ;
10+ tooltipEl . style . wordBreak = '' ;
1011
1112 switch ( referencedElement . dataset . position ) {
1213 case 'top' :
@@ -35,8 +36,12 @@ export function setTooltipPosition(tooltipEl, referencedElement) {
3536 if (
3637 [ 'top' , 'bottom' , 'top-center' ] . includes ( referencedElement . dataset . position )
3738 ) {
38- if ( rect . left + tooltipRect . width > window . innerWidth ) {
39- tooltipEl . style . right = `${ window . innerWidth - rect . right } px` ;
39+ if ( tooltipEl . clientWidth + 20 > window . innerWidth ) {
40+ tooltipEl . style . left = '10px' ;
41+ tooltipEl . style . right = '10px' ;
42+ tooltipEl . style . wordBreak = 'break-all' ;
43+ } else if ( rect . left + tooltipEl . clientWidth > window . innerWidth ) {
44+ tooltipEl . style . right = '10px' ;
4045 tooltipEl . style . left = 'auto' ;
4146 }
4247 }
You can’t perform that action at this time.
0 commit comments