Skip to content

Commit 6198646

Browse files
authored
fix: make tooltips work when Graphiql is not full page and window has scrolled (#3203)
1 parent cf590e3 commit 6198646

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.changeset/sour-monkeys-film.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'codemirror-graphql': patch
3+
---
4+
5+
fix info tooltips to work when Graphiql is not used as full page

packages/codemirror-graphql/src/utils/info-addon.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ function onMouseOver(cm: CodeMirror.Editor, e: MouseEvent) {
9090
}
9191

9292
function onMouseHover(cm: CodeMirror.Editor, box: DOMRect) {
93-
const pos = cm.coordsChar({
94-
left: (box.left + box.right) / 2,
95-
top: (box.top + box.bottom) / 2,
96-
});
93+
const pos = cm.coordsChar(
94+
{
95+
left: (box.left + box.right) / 2,
96+
top: (box.top + box.bottom) / 2,
97+
},
98+
'window',
99+
); // 'window' allows to work when editor is not full page and window has scrolled
97100

98101
const state = cm.state.info;
99102
const { options } = state;

0 commit comments

Comments
 (0)