Skip to content

Commit

Permalink
Adjust tooltip space to avoid information truncation
Browse files Browse the repository at this point in the history
Previously, long tooltips were flipped upwards and so
sometimes, it goes beyond the window's top edge.
This makes it difficult to view the information.
This fix will make sure that, the tooltip header always
stays within the window.

Resolves: firefox-devtools#883
  • Loading branch information
suba06 committed Oct 3, 2018
1 parent 861df4e commit f5c1561
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/shared/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ export default class Tooltip extends React.PureComponent<Props, State> {
let offsetY = 0;
if (interiorElement) {
if (
mouseY + interiorElement.offsetHeight + MOUSE_OFFSET >
window.innerHeight
interiorElement.offsetHeight + MOUSE_OFFSET <
window.innerHeight - mouseY
) {
offsetY = 0;
} else if (interiorElement.offsetHeight + MOUSE_OFFSET < mouseY) {
offsetY = interiorElement.offsetHeight + MOUSE_OFFSET;
} else {
offsetY = -MOUSE_OFFSET;
offsetY = mouseY;
}
}

Expand Down

0 comments on commit f5c1561

Please sign in to comment.