Skip to content

Commit

Permalink
Remove broken optimization in tooltip transform detection
Browse files Browse the repository at this point in the history
FIX: Fix a bug that could cause tooltips to be unnecessarily be positioned
absolutely.

See https://discuss.codemirror.net/t/tooltip-position-is-broken-after-recent-upgrade/7555
  • Loading branch information
marijnh committed Dec 13, 2023
1 parent 013b143 commit 9b9fd27
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,11 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
// transformed element when a transform interferes with fixed
// positioning.
makeAbsolute = dom.offsetParent != this.container.ownerDocument.body
} else {
} else if (dom.style.top == Outside && dom.style.left == "0px") {
// On other browsers, we have to awkwardly try and use other
// information to detect a transform.
if (this.view.scaleX != 1 || this.view.scaleY != 1) {
makeAbsolute = true
} else if (dom.style.top == Outside && dom.style.left == "0px") {
let rect = dom.getBoundingClientRect()
makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1
}
let rect = dom.getBoundingClientRect()
makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1
}
}
if (makeAbsolute || this.position == "absolute") {
Expand Down

0 comments on commit 9b9fd27

Please sign in to comment.