Skip to content

Commit

Permalink
Backport PR #13161: Always show tooltip in hover box even if edges ar…
Browse files Browse the repository at this point in the history
…e out of view (#13169)

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and krassowski committed Oct 4, 2022
1 parent 08a9f54 commit f382949
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/apputils/src/hoverbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export namespace HoverBox {
}

if (belowTheBottom) {
switch (outOfViewDisplay?.bottom || 'hidden-outsdie') {
switch (outOfViewDisplay?.bottom || 'hidden-outside') {
case 'hidden-inside':
if (!bottomEdgeInside) {
hide = true;
Expand Down Expand Up @@ -332,7 +332,7 @@ export namespace HoverBox {
}

if (afterTheRight) {
switch (outOfViewDisplay?.right || 'hidden-outsdie') {
switch (outOfViewDisplay?.right || 'hidden-outside') {
case 'hidden-inside':
if (!rightEdgeInside) {
hide = true;
Expand Down
10 changes: 9 additions & 1 deletion packages/tooltip/src/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,23 @@ export class Tooltip extends Widget {
const style = window.getComputedStyle(this.node);
const paddingLeft = parseInt(style.paddingLeft!, 10) || 0;

const host =
(editor.host.closest('.jp-MainAreaWidget > .lm-Widget') as HTMLElement) ||
editor.host;

// Calculate the geometry of the tooltip.
HoverBox.setGeometry({
anchor,
host: editor.host,
host,
maxHeight: MAX_HEIGHT,
minHeight: MIN_HEIGHT,
node: this.node,
offset: { horizontal: -1 * paddingLeft },
privilege: 'below',
outOfViewDisplay: {
top: 'stick-inside',
bottom: 'stick-inside'
},
style: style
});
}
Expand Down

0 comments on commit f382949

Please sign in to comment.