diff --git a/.changeset/disable-editor-ligatures.md b/.changeset/disable-editor-ligatures.md new file mode 100644 index 00000000000..ee885ebda51 --- /dev/null +++ b/.changeset/disable-editor-ligatures.md @@ -0,0 +1,5 @@ +--- +'@graphiql/react': patch +--- + +Disable Fira Code's font ligatures in the Monaco editors. Programming ligatures rewrote valid GraphQL into misleading glyphs — most notably `Int!=1` (a non-null `Int` with a default value of `1`) rendered as `Int≠1`, implying an inequality that isn't there. Characters now render literally. The Windows caret fix from #4040 is preserved. diff --git a/packages/graphiql-react/src/utility/create-editor.ts b/packages/graphiql-react/src/utility/create-editor.ts index ff1807f86ce..40f82938422 100644 --- a/packages/graphiql-react/src/utility/create-editor.ts +++ b/packages/graphiql-react/src/utility/create-editor.ts @@ -59,9 +59,14 @@ export function createEditor( }, scrollBeyondLastLine: false, // cleans up unnecessary "padding-bottom" on each editor fontFamily: '"Fira Code"', - // Enable font ligatures and fix incorrect caret position on Windows - // See: https://github.com/graphql/graphiql/issues/4040 - fontLigatures: true, + // Disable Fira Code's ligatures without regressing the Windows caret fix. + // This is deliberately an explicit `font-feature-settings` string, not + // `false`: Monaco only takes its monospace caret-measurement fast path when + // this exactly equals its OFF constant (`"liga" off, "calt" off`), and that + // fast path mis-positions the caret with Fira Code on Windows (#4040). Any + // other string keeps ligatures off while forcing per-character width + // measurement, so the caret stays correct. See PR #4430 for the full write-up. + fontLigatures: '"liga" off, "calt" off, "clig" off', lineNumbersMinChars: 2, // reduce line numbers width on the left size roundedSelection: false, // prevent multiline text selection from highlighting +1 characters after beginning/end of selection tabIndex: -1, // Do not allow tabbing into the editor, only via by pressing Enter or its container diff --git a/resources/custom-words.txt b/resources/custom-words.txt index 30a878e5e3a..b6ae352f1e2 100644 --- a/resources/custom-words.txt +++ b/resources/custom-words.txt @@ -43,8 +43,10 @@ borggreve bram browserslistrc calar +calt chainable changesets +clig clsx codebases codegen @@ -119,6 +121,7 @@ leebyron Leko LekoArts lezer +liga lightningcss linenumber linenumbers @@ -137,6 +140,7 @@ middlewares minipass mockfs modulemap +monospace multipass nauroze newhope