Skip to content

Commit

Permalink
fix: prevent default behavior of clicking a tag href. Closes #3565
Browse files Browse the repository at this point in the history
  • Loading branch information
retrodaredevil committed Mar 25, 2024
1 parent 7e86dc4 commit d05a7f0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/codemirror-graphql/src/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Check warning on line 304 in packages/codemirror-graphql/src/info.ts

View check run for this annotation

Codecov / codecov/patch

packages/codemirror-graphql/src/info.ts#L304

Added line #L304 was not covered by tests
onClick(ref, e);
});
} else {
Expand Down

0 comments on commit d05a7f0

Please sign in to comment.