-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: forced tooltips below if they will overflow expected width #914
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the change that we actually want.
The auto-placement calculation comes from popper
so I suspect there may be a bug in placement from that 3rd party library, but it should be trying to doing a best placement via the preventOverflow
modifier. It might mean we need to upgrade the version if there is an existing bug that has been fixed, or raise an issue with popper but we need to do a little digging first to determine how we want to handle this.
Is this PR still relevant? |
if (elemRect) { | ||
if (initialPlacement === 'right') { | ||
const offset = bodyRect.right - elemRect.right; | ||
if (offset < tooltipExpectedWidth && actualPlacement !== 'bottom') { | ||
placement = 'bottom'; | ||
setActualPlacement('bottom'); | ||
} | ||
} else if (initialPlacement === 'left') { | ||
const offset = elemRect.left; | ||
if (offset < tooltipExpectedWidth && actualPlacement !== 'bottom') { | ||
placement = 'bottom'; | ||
setActualPlacement('bottom'); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fun exercise: how would you write this code now over a year later?
Closes #905
A couple of discussion points for this would be to determine if we can calculate a minimum expected width and if we want to allow the user to define the minimum expected width.