diff --git a/.changeset/sharp-rules-hide.md b/.changeset/sharp-rules-hide.md new file mode 100644 index 00000000000..c4b5a4ef1f6 --- /dev/null +++ b/.changeset/sharp-rules-hide.md @@ -0,0 +1,5 @@ +--- +'codemirror-graphql': patch +--- + +tooltip a tag's click listener calls event.preventDefault() to stop navigating away from page diff --git a/packages/codemirror-graphql/src/info.ts b/packages/codemirror-graphql/src/info.ts index dedea07e170..4b57bf1fecd 100644 --- a/packages/codemirror-graphql/src/info.ts +++ b/packages/codemirror-graphql/src/info.ts @@ -299,6 +299,9 @@ function text( // want clicking the node to navigate anywhere. node.href = 'javascript:void 0'; // eslint-disable-line no-script-url node.addEventListener('click', (e: MouseEvent) => { + // Although an href of 'javascript:void 0' should never navigate away from the page, + // that is not always the case: https://github.com/graphql/graphiql/issues/3565 + e.preventDefault(); onClick(ref, e); }); } else {